SlideShare a Scribd company logo
JAVABEANS
JAVA BEANS:
A “Bean” is a reusable software component model based on sun’s java bean
specification that can be manipulated visually in a builder tool.
The term software component model describe how to create and use reusable
software components to build an application
Builder tool is nothing but an application development tool which lets you both to
create new beans or use existing beans to create an application.
To enrich the software systems by adopting component technology JAVA came up
with the concept called Java Beans.
Java provides the facility of creating some user defined components by
means of Bean programming.
Advantages of Java Beans:
•
• The java beans posses the property of “Write once and run anywhere”.
•
• Beans can work in different local platforms.
•
• Beans have the capability of capturing the events sent by other objects and vice versa enabling
object communication.
•
• The properties, events and methods of the bean can be controlled by the application developer.
(ex. Add new properties)
•
– Beans can be configured with the help of auxiliary software during design time.(no hassle at runtime)
•
– The configuration setting can be made persistent.(reused)
•
– Configuration setting of a bean can be saved in persistent storage and restored later.
• JavaBeans basic rules:
•
• A Java Bean should:
•
• be public , implements the Serializable interface ,have a no-arg constructor and be derived from
javax.swing.JComponent or java.awt.Component if it is visual.
•
• The classes and interfaces defined in the java.beans package enable you to create JavaBeans.
•
• The Java Bean components can exist in one of the following three phases of development:
•
• Construction phase
•
• Build phase
•
• Execution phase
• It supports the standard component architecture features of
Properties
•
• Events
•
• Methods
•
• Persistence.
•
• In addition Java Beans provides support for
•
• Introspection (Allows Automatic Analysis of a java beans)
Customization(To make it easy to configure a java beans component
• The JavaBean Component Specification:
•
• Customization: Is the ability of JavaBean to allow its properties to
be changed in build and execution phase. Persistence:- Is the ability
of JavaBean to save its state to disk or storage device and restore
the saved state when the JavaBean is reloaded.
•
• Communication:-Is the ability of JavaBean to notify change in its
properties to other JavaBeans or the container.
•
• Introspection:- Is the ability of a JavaBean to allow an external
application to query the properties,methods, and events supported
by it.
•
• Features of a JavaBean:
• Support for “introspection” so that a builder tool can
analyze how a bean works.
• Support for “customization” to allow the customisation of
the appearance and behaviour of a bean.
• Support for “events” as a simple communication metaphor
than can be used to connect up beans.
• Support for “properties”, both for customization and for
programmatic use.
• Support for “persistence”, so that a bean can save and
restore its customized state.
• Steps to Develop a User-Defined JavaBean:
• Create a directory for the new bean
• Create the java bean source file(s)
• Compile the source file(s)
• Create a manifest file
• Generate a JAR file
• Start BDK
• Load Jar file
• Test.
• Introspection:
•
• Introspection can be defined as the technique of obtaining information about
bean properties, events and methods. Without introspection, the JavaBeans
technology could not operate.
•
• Persistence:
•
• Persistence means an ability to save properties and events of user deffined beans
to non-volatile storage and retrieve later.That is the state of the bean is stored and
retrived.
•
• Property:
•
• A property is a subset of a Bean’s state. Examples of bean properties include color,
label, font, font size, and display size.
• Types of JavaBeans Properties:
•
• Simple properties:- Simple properties refer to the private variables of a JavaBean that can have only a single value.
Simple properties are retrieved and specified using the get and set methods respectively.
•
• Boolean properties:- A Boolean property is a property which is used to represent the values True or False. Let N be
the name of the property and T be the type of the value then the methods are
•
• public boolean isN();
•
• public void setN(boolean parameter); public Boolean getN();
•
• Indexed properties:- Indexed Properties consists of multiple values.If a simple property can hold an
•
• array of value they are no longer called simple butinstead indexed properties. An indexed property may expose
set/get methods to read/write one element in the array (so-called ’index getter/setter’) and/or so-called ’array
getter/setter’ which read/write the entire array.
•
• Bound properties:- A bean that has a bound property generates an event when the property is changed.
•
• Constrained properties:- It generates an event when an attempt is made to change its value.
• Handling Events in JavaBeans:
•
• Enables Beans to communicate and connect together.
•
• Beans generate events and these events can be sent to other
objects.
•
• Event means any activity that interrupts the current ongoing
activity.
•
• Example: mouse clicks, pressing key…
•
APPLETS
• Definition:
• Applet is a special type of small java program
that is embedded in the webpage to generate
the dynamic content.
• It runs inside the java enabled web browser
and works at client side.
• Difference between Applet and java application:
•
• An applet is a Java class that extends the java.applet.Applet class.
•
• A main method is not invoked on an applet, and an applet class will not define main.
•
• Applets are designed to be embedded within an HTML page.
•
• When a user views an HTML page that contains an applet, the code for the applet is
downloaded to the user's machine.
•
• A JVM is required to view an applet. The JVM can be either a plug-in of the Web browser or a
separate runtime environment. The JVM on the user's machine creates an instance of the
applet class and invokes various methods during the applet's lifetime.
•
• Applets have strict security rules that are enforced by the Web browser. The security of an
applet is often referred to as sandbox security, comparing the applet to a child playing in a
sandbox with various rules that must be followed.
•
• Other classes that the applet needs can be downloaded in a single Java Archive JAR file.
web programmimg- concpt in JAVABEANS.ppt
• Advantage:
• Platform Independent.
• Applets don’t have compatibility issues with different versions of java.
• Applets cache quickly, that’s why there will be no latency in downloading of them.
• It can also be used for a real time application.
• They can pay out different type of action on client-side machine like-
• Playing sound
• Viewing images
•
• Get user input
•
• Get mouse clicks
•
• Get user keystrokes
•
• They increase interactivity for users.
•
• Java has constituted security, by this feature of java; an applet doesn’t produce any harmful activity.
•
• Database integration is another important advantage of applets.
• Disadvantage:
•
• Some browsers especially mobile browsers which are running on Apple IOS or Android don’t support applets run.
•
• If a proxy server is applied to web access, than automatically installation and update of Java can be failed, that’s why
applets can’t run with specific requirements unless Java is manually installed or updated.
•
• Applets don’t access client-side resources, like-
•
• Files
•
• Operating system
•
• Applets have to tag as trusted applets and they must be registered to APS (Applet Security Manager).
•
• Applet cannot work with native methods.
•
• Applet can only extract information about client-machine is its name, java version, OS, version.
Life Cycle of an applet:
• init() – Execution of an applet starts from here. It is coequal to born stage of a thread. This is the first method (it is called
before all other methods). A programmer can exploit this method to instantiate objects, initialize variables, setting
background and foreground colors in GUI etc. In this method Applet is created but remains inactive.
• start() – In this method Applet become active, and become eligible for processor time. Because an inactive Applet is not
eligible for processor time.
•
• 3. paint() – this method is requested instantly after the start () method, this method takes a java.awt.Graphics
object as parameter, this is the only place where a programmer can write his code.
•
• stop() – This method makes an Applet inactive temporarily, and it is called directly when the user moves off the page on
which the applet sits.
• 5. destroy() – In this method an Applet become dead, and it’s the best place to have cleanup code.
•
• destroy() method is called when the browser shuts down normally.
• First Applet program:
•
• import java.awt.*;
•
• import java.applet.*;
•
• public class applet1 extends Applet
•
• {
•
• public void paint(Graphics g)
•
• {
•
• g.drawString("Hello World",10,30);
•
• }
•
•
•
• }
• Applet1.html
•
• <html>
•
• <applet code="applet1.class" height=300 width=300>
•
• </applet>
•
• </html>
•
• Steps to execute:
• java.awt.Graphics class provides many methods for
graphics programming.
• Commonly used methods of Graphics class:
• public abstract void drawString(String str, int x, int y):
is used to draw the specified string.
• public void drawRect(int x, int y, int width, int height):
draws a rectangle with the specified width and height.
• public abstract void fillRect(int x, int y, int width, int
height): is used to fill rectangle with the default color
and specified width and height.
• public abstract void drawOval(int x, int y, int width, int height): is used to draw oval with the specified width and height.
•
• public abstract void fillOval(int x, int y, int width, int height): is used to fill oval with the default color and specified
width and height.
•
• public abstract void drawLine(int x1, int y1, int x2, int y2): is used to draw line between the points(x1, y1) and (x2, y2).
•
• public abstract boolean drawImage(Image img, int x, int y, ImageObserver observer): is used draw the specified image.
•
• public abstract void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle): is used draw a circular or
elliptical arc.
•
• public abstract void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle): is used to fill a circular or
elliptical arc.
•
• public abstract void setColor(Color c): is used to set the graphics current color to the specified color.
•
• public abstract void setFont(Font font): is used to set the graphics current font to the specified font.
•
• Adding images to Applet:
•
• First step is to create the image's URL object by calling either the getDocumentBase() or getCodeBase()
method. The former returns the URL of the directory from which the current HTML file was loaded,
•
• whereas the latter returns the URL of the directory from which the applet was run.
•
• public URL getDocumentBase(): is used to return the URL of the document in which applet is embedded.
• public URL getCodeBase(): is used to return the base URL.
• Create the Object for image using the function public Image getImage(URL u, String image){}
•
• Load the image in applet . public abstract boolean drawImage(Image img, int x, int y, ImageObserver
observer): is used draw the specified image.
• Other drawimage methods:
•
• drawImage(Image img, int x, int y, Color bgcolor, ImageObserver observer)
• Draws as much of the specified image as is currently available.
•
• drawImage(Image img, int x, int y, ImageObserver observer) Draws as much of the specified image as is currently available.
•
• drawImage(Image img, int x, int y, int width, int height, Color bgcolor, ImageObserver observer) Draws as much of the specified
image as has already been scaled to fit inside the specified rectangle.
• drawImage(Image img, int x, int y, int width, int height, ImageObserver observer)
• Draws as much of the specified image as has already been scaled to fit inside the specified rectangle.
•
• drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color bgcolor, ImageObserver observer)
•
• Draws as much of the specified area of the specified image as is currently available, scaling it on the fly to fit inside the
specified area of the destination drawable surface.
• drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2,
• int sy2, ImageObserver observer)
•
• Draws as much of the specified area of the specified image as is currently available, scaling it on the fly to fit inside the
specified area of the destination drawable surface.
• Example program:
• import java.applet.Applet;
• import java.awt.Graphics;
• import java.awt.Image;
• public class AppletImage extends Applet
• {
• Image img;
• public void init()
• {
• img=getImage(getDocumentBase(),getParameter("img"));
• }
• public void paint(Graphics g)
• {
• g.drawImage(img,0,0,this);
• g.drawImage(img,150,150,300,140,this);//scaled image.
• }
• }
• Html file
• html>
• <applet code="AppletImage.class" height=300 width=300> <param name="img" value="java.png"> </applet>
• </html>
• Output:
web programmimg- concpt in JAVABEANS.ppt
web programmimg- concpt in JAVABEANS.ppt
Ad

More Related Content

Similar to web programmimg- concpt in JAVABEANS.ppt (20)

Java virtual machine
Java virtual machineJava virtual machine
Java virtual machine
baabtra.com - No. 1 supplier of quality freshers
 
java basics concepts and the keywords needed
java basics concepts and the keywords neededjava basics concepts and the keywords needed
java basics concepts and the keywords needed
PriyadharshiniG41
 
Java beans
Java beansJava beans
Java beans
Rajkiran Mummadi
 
javaapplet.pptx bhhhhjhjhjhjhjhjhjhj
javaapplet.pptx        bhhhhjhjhjhjhjhjhjhjjavaapplet.pptx        bhhhhjhjhjhjhjhjhjhj
javaapplet.pptx bhhhhjhjhjhjhjhjhjhj
shesnasuneer
 
basic core java up to operator
basic core java up to operatorbasic core java up to operator
basic core java up to operator
kamal kotecha
 
Java basics notes
Java basics notesJava basics notes
Java basics notes
poonguzhali1826
 
01 java intro
01 java intro01 java intro
01 java intro
Deepal Shah
 
No Container: a Modern Java Stack with Bootique
No Container: a Modern Java Stack with BootiqueNo Container: a Modern Java Stack with Bootique
No Container: a Modern Java Stack with Bootique
Andrus Adamchik
 
java.pptx
java.pptxjava.pptx
java.pptx
PRASHANTKULKARNI133
 
JavaClassPresentation
JavaClassPresentationJavaClassPresentation
JavaClassPresentation
juliasceasor
 
1 java introduction
1 java introduction1 java introduction
1 java introduction
abdullah al mahamud rosi
 
1 java intro
1 java intro1 java intro
1 java intro
abdullah al mahamud rosi
 
Eclipse e4
Eclipse e4Eclipse e4
Eclipse e4
Chris Aniszczyk
 
Java Programming concept
Java Programming concept Java Programming concept
Java Programming concept
Prakash Poudel
 
Letest
LetestLetest
Letest
Prakash Poudel
 
JAVA PROGRAM CONSTRUCTS OR LANGUAGE BASICS.pptx
JAVA PROGRAM CONSTRUCTS OR LANGUAGE BASICS.pptxJAVA PROGRAM CONSTRUCTS OR LANGUAGE BASICS.pptx
JAVA PROGRAM CONSTRUCTS OR LANGUAGE BASICS.pptx
AALIM MUHAMMED SALEGH COLLEGE OF ENGINEERING
 
ITFT - Java Coding
ITFT - Java CodingITFT - Java Coding
ITFT - Java Coding
Blossom Sood
 
Java Apple dndkorksnsbsjdkkdjejdjrdndjdj
Java Apple dndkorksnsbsjdkkdjejdjrdndjdjJava Apple dndkorksnsbsjdkkdjejdjrdndjdj
Java Apple dndkorksnsbsjdkkdjejdjrdndjdj
midhunmsd143
 
applet.pptx
applet.pptxapplet.pptx
applet.pptx
SachinBhosale73
 
unit1.pptx
unit1.pptxunit1.pptx
unit1.pptx
PrasadKalal4
 

More from mcjaya2024 (20)

cyber forensics Email Investigations.ppt
cyber forensics Email Investigations.pptcyber forensics Email Investigations.ppt
cyber forensics Email Investigations.ppt
mcjaya2024
 
Cell Phone and Mobile Devices Forensics.ppt
Cell Phone and Mobile Devices Forensics.pptCell Phone and Mobile Devices Forensics.ppt
Cell Phone and Mobile Devices Forensics.ppt
mcjaya2024
 
Computer Forensics Analysis and Validation.ppt
Computer Forensics Analysis and Validation.pptComputer Forensics Analysis and Validation.ppt
Computer Forensics Analysis and Validation.ppt
mcjaya2024
 
cyber forensics Footprinting and Scanning.ppt
cyber forensics Footprinting and Scanning.pptcyber forensics Footprinting and Scanning.ppt
cyber forensics Footprinting and Scanning.ppt
mcjaya2024
 
cyber forensics-enum,sniffing,malware threat.ppt
cyber forensics-enum,sniffing,malware threat.pptcyber forensics-enum,sniffing,malware threat.ppt
cyber forensics-enum,sniffing,malware threat.ppt
mcjaya2024
 
Classless Interdomain Data Routing CIDR.ppt
Classless Interdomain Data Routing CIDR.pptClassless Interdomain Data Routing CIDR.ppt
Classless Interdomain Data Routing CIDR.ppt
mcjaya2024
 
Computer Network in Network software.ppt
Computer Network in Network software.pptComputer Network in Network software.ppt
Computer Network in Network software.ppt
mcjaya2024
 
web program-Extended MARKUP Language XML.ppt
web program-Extended MARKUP Language XML.pptweb program-Extended MARKUP Language XML.ppt
web program-Extended MARKUP Language XML.ppt
mcjaya2024
 
Web programming-Introduction to JSP.pptx
Web programming-Introduction to JSP.pptxWeb programming-Introduction to JSP.pptx
Web programming-Introduction to JSP.pptx
mcjaya2024
 
web program -Life cycle of a servlet.ppt
web program -Life cycle of a servlet.pptweb program -Life cycle of a servlet.ppt
web program -Life cycle of a servlet.ppt
mcjaya2024
 
web program-Inheritance,pack&except in Java.ppt
web program-Inheritance,pack&except in Java.pptweb program-Inheritance,pack&except in Java.ppt
web program-Inheritance,pack&except in Java.ppt
mcjaya2024
 
123 JAVA CLASSES, OBJECTS AND METHODS.ppt
123 JAVA CLASSES, OBJECTS AND METHODS.ppt123 JAVA CLASSES, OBJECTS AND METHODS.ppt
123 JAVA CLASSES, OBJECTS AND METHODS.ppt
mcjaya2024
 
web programming-Multithreading concept in Java.ppt
web programming-Multithreading concept in Java.pptweb programming-Multithreading concept in Java.ppt
web programming-Multithreading concept in Java.ppt
mcjaya2024
 
Processing Crime and Incident Scenes.ppt
Processing Crime and Incident Scenes.pptProcessing Crime and Incident Scenes.ppt
Processing Crime and Incident Scenes.ppt
mcjaya2024
 
Working with Windows and DOS Systems (1).ppt
Working with Windows and DOS Systems (1).pptWorking with Windows and DOS Systems (1).ppt
Working with Windows and DOS Systems (1).ppt
mcjaya2024
 
enterprise resource plnning ERP vendors.pdf
enterprise resource plnning ERP vendors.pdfenterprise resource plnning ERP vendors.pdf
enterprise resource plnning ERP vendors.pdf
mcjaya2024
 
ERP and elctronic commerce online12.ppt
ERP  and elctronic commerce online12.pptERP  and elctronic commerce online12.ppt
ERP and elctronic commerce online12.ppt
mcjaya2024
 
Enterprise resourse planning ERPlife cycle.ppt
Enterprise resourse planning ERPlife cycle.pptEnterprise resourse planning ERPlife cycle.ppt
Enterprise resourse planning ERPlife cycle.ppt
mcjaya2024
 
Project Management Issues in ERP IS 6006.ppt
Project Management Issues in ERP IS 6006.pptProject Management Issues in ERP IS 6006.ppt
Project Management Issues in ERP IS 6006.ppt
mcjaya2024
 
mySAP_Supply_Chain_Management_Solution_Map.pdf
mySAP_Supply_Chain_Management_Solution_Map.pdfmySAP_Supply_Chain_Management_Solution_Map.pdf
mySAP_Supply_Chain_Management_Solution_Map.pdf
mcjaya2024
 
cyber forensics Email Investigations.ppt
cyber forensics Email Investigations.pptcyber forensics Email Investigations.ppt
cyber forensics Email Investigations.ppt
mcjaya2024
 
Cell Phone and Mobile Devices Forensics.ppt
Cell Phone and Mobile Devices Forensics.pptCell Phone and Mobile Devices Forensics.ppt
Cell Phone and Mobile Devices Forensics.ppt
mcjaya2024
 
Computer Forensics Analysis and Validation.ppt
Computer Forensics Analysis and Validation.pptComputer Forensics Analysis and Validation.ppt
Computer Forensics Analysis and Validation.ppt
mcjaya2024
 
cyber forensics Footprinting and Scanning.ppt
cyber forensics Footprinting and Scanning.pptcyber forensics Footprinting and Scanning.ppt
cyber forensics Footprinting and Scanning.ppt
mcjaya2024
 
cyber forensics-enum,sniffing,malware threat.ppt
cyber forensics-enum,sniffing,malware threat.pptcyber forensics-enum,sniffing,malware threat.ppt
cyber forensics-enum,sniffing,malware threat.ppt
mcjaya2024
 
Classless Interdomain Data Routing CIDR.ppt
Classless Interdomain Data Routing CIDR.pptClassless Interdomain Data Routing CIDR.ppt
Classless Interdomain Data Routing CIDR.ppt
mcjaya2024
 
Computer Network in Network software.ppt
Computer Network in Network software.pptComputer Network in Network software.ppt
Computer Network in Network software.ppt
mcjaya2024
 
web program-Extended MARKUP Language XML.ppt
web program-Extended MARKUP Language XML.pptweb program-Extended MARKUP Language XML.ppt
web program-Extended MARKUP Language XML.ppt
mcjaya2024
 
Web programming-Introduction to JSP.pptx
Web programming-Introduction to JSP.pptxWeb programming-Introduction to JSP.pptx
Web programming-Introduction to JSP.pptx
mcjaya2024
 
web program -Life cycle of a servlet.ppt
web program -Life cycle of a servlet.pptweb program -Life cycle of a servlet.ppt
web program -Life cycle of a servlet.ppt
mcjaya2024
 
web program-Inheritance,pack&except in Java.ppt
web program-Inheritance,pack&except in Java.pptweb program-Inheritance,pack&except in Java.ppt
web program-Inheritance,pack&except in Java.ppt
mcjaya2024
 
123 JAVA CLASSES, OBJECTS AND METHODS.ppt
123 JAVA CLASSES, OBJECTS AND METHODS.ppt123 JAVA CLASSES, OBJECTS AND METHODS.ppt
123 JAVA CLASSES, OBJECTS AND METHODS.ppt
mcjaya2024
 
web programming-Multithreading concept in Java.ppt
web programming-Multithreading concept in Java.pptweb programming-Multithreading concept in Java.ppt
web programming-Multithreading concept in Java.ppt
mcjaya2024
 
Processing Crime and Incident Scenes.ppt
Processing Crime and Incident Scenes.pptProcessing Crime and Incident Scenes.ppt
Processing Crime and Incident Scenes.ppt
mcjaya2024
 
Working with Windows and DOS Systems (1).ppt
Working with Windows and DOS Systems (1).pptWorking with Windows and DOS Systems (1).ppt
Working with Windows and DOS Systems (1).ppt
mcjaya2024
 
enterprise resource plnning ERP vendors.pdf
enterprise resource plnning ERP vendors.pdfenterprise resource plnning ERP vendors.pdf
enterprise resource plnning ERP vendors.pdf
mcjaya2024
 
ERP and elctronic commerce online12.ppt
ERP  and elctronic commerce online12.pptERP  and elctronic commerce online12.ppt
ERP and elctronic commerce online12.ppt
mcjaya2024
 
Enterprise resourse planning ERPlife cycle.ppt
Enterprise resourse planning ERPlife cycle.pptEnterprise resourse planning ERPlife cycle.ppt
Enterprise resourse planning ERPlife cycle.ppt
mcjaya2024
 
Project Management Issues in ERP IS 6006.ppt
Project Management Issues in ERP IS 6006.pptProject Management Issues in ERP IS 6006.ppt
Project Management Issues in ERP IS 6006.ppt
mcjaya2024
 
mySAP_Supply_Chain_Management_Solution_Map.pdf
mySAP_Supply_Chain_Management_Solution_Map.pdfmySAP_Supply_Chain_Management_Solution_Map.pdf
mySAP_Supply_Chain_Management_Solution_Map.pdf
mcjaya2024
 
Ad

Recently uploaded (20)

Machine foundation notes for civil engineering students
Machine foundation notes for civil engineering studentsMachine foundation notes for civil engineering students
Machine foundation notes for civil engineering students
DYPCET
 
Slide share PPT of SOx control technologies.pptx
Slide share PPT of SOx control technologies.pptxSlide share PPT of SOx control technologies.pptx
Slide share PPT of SOx control technologies.pptx
vvsasane
 
Mode-Wise Corridor Level Travel-Time Estimation Using Machine Learning Models
Mode-Wise Corridor Level Travel-Time Estimation Using Machine Learning ModelsMode-Wise Corridor Level Travel-Time Estimation Using Machine Learning Models
Mode-Wise Corridor Level Travel-Time Estimation Using Machine Learning Models
Journal of Soft Computing in Civil Engineering
 
acid base ppt and their specific application in food
acid base ppt and their specific application in foodacid base ppt and their specific application in food
acid base ppt and their specific application in food
Fatehatun Noor
 
Automatic Quality Assessment for Speech and Beyond
Automatic Quality Assessment for Speech and BeyondAutomatic Quality Assessment for Speech and Beyond
Automatic Quality Assessment for Speech and Beyond
NU_I_TODALAB
 
Design Optimization of Reinforced Concrete Waffle Slab Using Genetic Algorithm
Design Optimization of Reinforced Concrete Waffle Slab Using Genetic AlgorithmDesign Optimization of Reinforced Concrete Waffle Slab Using Genetic Algorithm
Design Optimization of Reinforced Concrete Waffle Slab Using Genetic Algorithm
Journal of Soft Computing in Civil Engineering
 
Construction-Chemicals-For-Waterproofing.ppt
Construction-Chemicals-For-Waterproofing.pptConstruction-Chemicals-For-Waterproofing.ppt
Construction-Chemicals-For-Waterproofing.ppt
ssuser2ffcbc
 
Water Industry Process Automation & Control Monthly May 2025
Water Industry Process Automation & Control Monthly May 2025Water Industry Process Automation & Control Monthly May 2025
Water Industry Process Automation & Control Monthly May 2025
Water Industry Process Automation & Control
 
Transport modelling at SBB, presentation at EPFL in 2025
Transport modelling at SBB, presentation at EPFL in 2025Transport modelling at SBB, presentation at EPFL in 2025
Transport modelling at SBB, presentation at EPFL in 2025
Antonin Danalet
 
Little Known Ways To 3 Best sites to Buy Linkedin Accounts.pdf
Little Known Ways To 3 Best sites to Buy Linkedin Accounts.pdfLittle Known Ways To 3 Best sites to Buy Linkedin Accounts.pdf
Little Known Ways To 3 Best sites to Buy Linkedin Accounts.pdf
gori42199
 
Generative AI & Large Language Models Agents
Generative AI & Large Language Models AgentsGenerative AI & Large Language Models Agents
Generative AI & Large Language Models Agents
aasgharbee22seecs
 
Slide share PPT of NOx control technologies.pptx
Slide share PPT of  NOx control technologies.pptxSlide share PPT of  NOx control technologies.pptx
Slide share PPT of NOx control technologies.pptx
vvsasane
 
Environment .................................
Environment .................................Environment .................................
Environment .................................
shadyozq9
 
Frontend Architecture Diagram/Guide For Frontend Engineers
Frontend Architecture Diagram/Guide For Frontend EngineersFrontend Architecture Diagram/Guide For Frontend Engineers
Frontend Architecture Diagram/Guide For Frontend Engineers
Michael Hertzberg
 
introduction technology technology tec.pptx
introduction technology technology tec.pptxintroduction technology technology tec.pptx
introduction technology technology tec.pptx
Iftikhar70
 
Deepfake Phishing: A New Frontier in Cyber Threats
Deepfake Phishing: A New Frontier in Cyber ThreatsDeepfake Phishing: A New Frontier in Cyber Threats
Deepfake Phishing: A New Frontier in Cyber Threats
RaviKumar256934
 
ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdfML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
rameshwarchintamani
 
IBAAS 2023 Series_Lecture 8- Dr. Nandi.pdf
IBAAS 2023 Series_Lecture 8- Dr. Nandi.pdfIBAAS 2023 Series_Lecture 8- Dr. Nandi.pdf
IBAAS 2023 Series_Lecture 8- Dr. Nandi.pdf
VigneshPalaniappanM
 
David Boutry - Specializes In AWS, Microservices And Python.pdf
David Boutry - Specializes In AWS, Microservices And Python.pdfDavid Boutry - Specializes In AWS, Microservices And Python.pdf
David Boutry - Specializes In AWS, Microservices And Python.pdf
David Boutry
 
Personal Protective Efsgfgsffquipment.ppt
Personal Protective Efsgfgsffquipment.pptPersonal Protective Efsgfgsffquipment.ppt
Personal Protective Efsgfgsffquipment.ppt
ganjangbegu579
 
Machine foundation notes for civil engineering students
Machine foundation notes for civil engineering studentsMachine foundation notes for civil engineering students
Machine foundation notes for civil engineering students
DYPCET
 
Slide share PPT of SOx control technologies.pptx
Slide share PPT of SOx control technologies.pptxSlide share PPT of SOx control technologies.pptx
Slide share PPT of SOx control technologies.pptx
vvsasane
 
acid base ppt and their specific application in food
acid base ppt and their specific application in foodacid base ppt and their specific application in food
acid base ppt and their specific application in food
Fatehatun Noor
 
Automatic Quality Assessment for Speech and Beyond
Automatic Quality Assessment for Speech and BeyondAutomatic Quality Assessment for Speech and Beyond
Automatic Quality Assessment for Speech and Beyond
NU_I_TODALAB
 
Construction-Chemicals-For-Waterproofing.ppt
Construction-Chemicals-For-Waterproofing.pptConstruction-Chemicals-For-Waterproofing.ppt
Construction-Chemicals-For-Waterproofing.ppt
ssuser2ffcbc
 
Transport modelling at SBB, presentation at EPFL in 2025
Transport modelling at SBB, presentation at EPFL in 2025Transport modelling at SBB, presentation at EPFL in 2025
Transport modelling at SBB, presentation at EPFL in 2025
Antonin Danalet
 
Little Known Ways To 3 Best sites to Buy Linkedin Accounts.pdf
Little Known Ways To 3 Best sites to Buy Linkedin Accounts.pdfLittle Known Ways To 3 Best sites to Buy Linkedin Accounts.pdf
Little Known Ways To 3 Best sites to Buy Linkedin Accounts.pdf
gori42199
 
Generative AI & Large Language Models Agents
Generative AI & Large Language Models AgentsGenerative AI & Large Language Models Agents
Generative AI & Large Language Models Agents
aasgharbee22seecs
 
Slide share PPT of NOx control technologies.pptx
Slide share PPT of  NOx control technologies.pptxSlide share PPT of  NOx control technologies.pptx
Slide share PPT of NOx control technologies.pptx
vvsasane
 
Environment .................................
Environment .................................Environment .................................
Environment .................................
shadyozq9
 
Frontend Architecture Diagram/Guide For Frontend Engineers
Frontend Architecture Diagram/Guide For Frontend EngineersFrontend Architecture Diagram/Guide For Frontend Engineers
Frontend Architecture Diagram/Guide For Frontend Engineers
Michael Hertzberg
 
introduction technology technology tec.pptx
introduction technology technology tec.pptxintroduction technology technology tec.pptx
introduction technology technology tec.pptx
Iftikhar70
 
Deepfake Phishing: A New Frontier in Cyber Threats
Deepfake Phishing: A New Frontier in Cyber ThreatsDeepfake Phishing: A New Frontier in Cyber Threats
Deepfake Phishing: A New Frontier in Cyber Threats
RaviKumar256934
 
ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdfML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
rameshwarchintamani
 
IBAAS 2023 Series_Lecture 8- Dr. Nandi.pdf
IBAAS 2023 Series_Lecture 8- Dr. Nandi.pdfIBAAS 2023 Series_Lecture 8- Dr. Nandi.pdf
IBAAS 2023 Series_Lecture 8- Dr. Nandi.pdf
VigneshPalaniappanM
 
David Boutry - Specializes In AWS, Microservices And Python.pdf
David Boutry - Specializes In AWS, Microservices And Python.pdfDavid Boutry - Specializes In AWS, Microservices And Python.pdf
David Boutry - Specializes In AWS, Microservices And Python.pdf
David Boutry
 
Personal Protective Efsgfgsffquipment.ppt
Personal Protective Efsgfgsffquipment.pptPersonal Protective Efsgfgsffquipment.ppt
Personal Protective Efsgfgsffquipment.ppt
ganjangbegu579
 
Ad

web programmimg- concpt in JAVABEANS.ppt

  • 2. JAVA BEANS: A “Bean” is a reusable software component model based on sun’s java bean specification that can be manipulated visually in a builder tool. The term software component model describe how to create and use reusable software components to build an application Builder tool is nothing but an application development tool which lets you both to create new beans or use existing beans to create an application. To enrich the software systems by adopting component technology JAVA came up with the concept called Java Beans. Java provides the facility of creating some user defined components by means of Bean programming.
  • 3. Advantages of Java Beans: • • The java beans posses the property of “Write once and run anywhere”. • • Beans can work in different local platforms. • • Beans have the capability of capturing the events sent by other objects and vice versa enabling object communication. • • The properties, events and methods of the bean can be controlled by the application developer. (ex. Add new properties) • – Beans can be configured with the help of auxiliary software during design time.(no hassle at runtime) • – The configuration setting can be made persistent.(reused) • – Configuration setting of a bean can be saved in persistent storage and restored later.
  • 4. • JavaBeans basic rules: • • A Java Bean should: • • be public , implements the Serializable interface ,have a no-arg constructor and be derived from javax.swing.JComponent or java.awt.Component if it is visual. • • The classes and interfaces defined in the java.beans package enable you to create JavaBeans. • • The Java Bean components can exist in one of the following three phases of development: • • Construction phase • • Build phase • • Execution phase
  • 5. • It supports the standard component architecture features of Properties • • Events • • Methods • • Persistence. • • In addition Java Beans provides support for • • Introspection (Allows Automatic Analysis of a java beans) Customization(To make it easy to configure a java beans component
  • 6. • The JavaBean Component Specification: • • Customization: Is the ability of JavaBean to allow its properties to be changed in build and execution phase. Persistence:- Is the ability of JavaBean to save its state to disk or storage device and restore the saved state when the JavaBean is reloaded. • • Communication:-Is the ability of JavaBean to notify change in its properties to other JavaBeans or the container. • • Introspection:- Is the ability of a JavaBean to allow an external application to query the properties,methods, and events supported by it. •
  • 7. • Features of a JavaBean: • Support for “introspection” so that a builder tool can analyze how a bean works. • Support for “customization” to allow the customisation of the appearance and behaviour of a bean. • Support for “events” as a simple communication metaphor than can be used to connect up beans. • Support for “properties”, both for customization and for programmatic use. • Support for “persistence”, so that a bean can save and restore its customized state.
  • 8. • Steps to Develop a User-Defined JavaBean: • Create a directory for the new bean • Create the java bean source file(s) • Compile the source file(s) • Create a manifest file • Generate a JAR file • Start BDK • Load Jar file • Test.
  • 9. • Introspection: • • Introspection can be defined as the technique of obtaining information about bean properties, events and methods. Without introspection, the JavaBeans technology could not operate. • • Persistence: • • Persistence means an ability to save properties and events of user deffined beans to non-volatile storage and retrieve later.That is the state of the bean is stored and retrived. • • Property: • • A property is a subset of a Bean’s state. Examples of bean properties include color, label, font, font size, and display size.
  • 10. • Types of JavaBeans Properties: • • Simple properties:- Simple properties refer to the private variables of a JavaBean that can have only a single value. Simple properties are retrieved and specified using the get and set methods respectively. • • Boolean properties:- A Boolean property is a property which is used to represent the values True or False. Let N be the name of the property and T be the type of the value then the methods are • • public boolean isN(); • • public void setN(boolean parameter); public Boolean getN(); • • Indexed properties:- Indexed Properties consists of multiple values.If a simple property can hold an • • array of value they are no longer called simple butinstead indexed properties. An indexed property may expose set/get methods to read/write one element in the array (so-called ’index getter/setter’) and/or so-called ’array getter/setter’ which read/write the entire array. • • Bound properties:- A bean that has a bound property generates an event when the property is changed. • • Constrained properties:- It generates an event when an attempt is made to change its value.
  • 11. • Handling Events in JavaBeans: • • Enables Beans to communicate and connect together. • • Beans generate events and these events can be sent to other objects. • • Event means any activity that interrupts the current ongoing activity. • • Example: mouse clicks, pressing key… •
  • 12. APPLETS • Definition: • Applet is a special type of small java program that is embedded in the webpage to generate the dynamic content. • It runs inside the java enabled web browser and works at client side.
  • 13. • Difference between Applet and java application: • • An applet is a Java class that extends the java.applet.Applet class. • • A main method is not invoked on an applet, and an applet class will not define main. • • Applets are designed to be embedded within an HTML page. • • When a user views an HTML page that contains an applet, the code for the applet is downloaded to the user's machine. • • A JVM is required to view an applet. The JVM can be either a plug-in of the Web browser or a separate runtime environment. The JVM on the user's machine creates an instance of the applet class and invokes various methods during the applet's lifetime. • • Applets have strict security rules that are enforced by the Web browser. The security of an applet is often referred to as sandbox security, comparing the applet to a child playing in a sandbox with various rules that must be followed. • • Other classes that the applet needs can be downloaded in a single Java Archive JAR file.
  • 15. • Advantage: • Platform Independent. • Applets don’t have compatibility issues with different versions of java. • Applets cache quickly, that’s why there will be no latency in downloading of them. • It can also be used for a real time application. • They can pay out different type of action on client-side machine like- • Playing sound • Viewing images • • Get user input • • Get mouse clicks • • Get user keystrokes • • They increase interactivity for users. • • Java has constituted security, by this feature of java; an applet doesn’t produce any harmful activity. • • Database integration is another important advantage of applets.
  • 16. • Disadvantage: • • Some browsers especially mobile browsers which are running on Apple IOS or Android don’t support applets run. • • If a proxy server is applied to web access, than automatically installation and update of Java can be failed, that’s why applets can’t run with specific requirements unless Java is manually installed or updated. • • Applets don’t access client-side resources, like- • • Files • • Operating system • • Applets have to tag as trusted applets and they must be registered to APS (Applet Security Manager). • • Applet cannot work with native methods. • • Applet can only extract information about client-machine is its name, java version, OS, version.
  • 17. Life Cycle of an applet:
  • 18. • init() – Execution of an applet starts from here. It is coequal to born stage of a thread. This is the first method (it is called before all other methods). A programmer can exploit this method to instantiate objects, initialize variables, setting background and foreground colors in GUI etc. In this method Applet is created but remains inactive. • start() – In this method Applet become active, and become eligible for processor time. Because an inactive Applet is not eligible for processor time. • • 3. paint() – this method is requested instantly after the start () method, this method takes a java.awt.Graphics object as parameter, this is the only place where a programmer can write his code. • • stop() – This method makes an Applet inactive temporarily, and it is called directly when the user moves off the page on which the applet sits. • 5. destroy() – In this method an Applet become dead, and it’s the best place to have cleanup code. • • destroy() method is called when the browser shuts down normally.
  • 19. • First Applet program: • • import java.awt.*; • • import java.applet.*; • • public class applet1 extends Applet • • { • • public void paint(Graphics g) • • { • • g.drawString("Hello World",10,30); • • } • • • • }
  • 20. • Applet1.html • • <html> • • <applet code="applet1.class" height=300 width=300> • • </applet> • • </html> • • Steps to execute:
  • 21. • java.awt.Graphics class provides many methods for graphics programming. • Commonly used methods of Graphics class: • public abstract void drawString(String str, int x, int y): is used to draw the specified string. • public void drawRect(int x, int y, int width, int height): draws a rectangle with the specified width and height. • public abstract void fillRect(int x, int y, int width, int height): is used to fill rectangle with the default color and specified width and height.
  • 22. • public abstract void drawOval(int x, int y, int width, int height): is used to draw oval with the specified width and height. • • public abstract void fillOval(int x, int y, int width, int height): is used to fill oval with the default color and specified width and height. • • public abstract void drawLine(int x1, int y1, int x2, int y2): is used to draw line between the points(x1, y1) and (x2, y2). • • public abstract boolean drawImage(Image img, int x, int y, ImageObserver observer): is used draw the specified image. • • public abstract void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle): is used draw a circular or elliptical arc. • • public abstract void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle): is used to fill a circular or elliptical arc. • • public abstract void setColor(Color c): is used to set the graphics current color to the specified color. • • public abstract void setFont(Font font): is used to set the graphics current font to the specified font. •
  • 23. • Adding images to Applet: • • First step is to create the image's URL object by calling either the getDocumentBase() or getCodeBase() method. The former returns the URL of the directory from which the current HTML file was loaded, • • whereas the latter returns the URL of the directory from which the applet was run. • • public URL getDocumentBase(): is used to return the URL of the document in which applet is embedded. • public URL getCodeBase(): is used to return the base URL. • Create the Object for image using the function public Image getImage(URL u, String image){} • • Load the image in applet . public abstract boolean drawImage(Image img, int x, int y, ImageObserver observer): is used draw the specified image.
  • 24. • Other drawimage methods: • • drawImage(Image img, int x, int y, Color bgcolor, ImageObserver observer) • Draws as much of the specified image as is currently available. • • drawImage(Image img, int x, int y, ImageObserver observer) Draws as much of the specified image as is currently available. • • drawImage(Image img, int x, int y, int width, int height, Color bgcolor, ImageObserver observer) Draws as much of the specified image as has already been scaled to fit inside the specified rectangle. • drawImage(Image img, int x, int y, int width, int height, ImageObserver observer) • Draws as much of the specified image as has already been scaled to fit inside the specified rectangle. • • drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color bgcolor, ImageObserver observer) • • Draws as much of the specified area of the specified image as is currently available, scaling it on the fly to fit inside the specified area of the destination drawable surface. • drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, • int sy2, ImageObserver observer) • • Draws as much of the specified area of the specified image as is currently available, scaling it on the fly to fit inside the specified area of the destination drawable surface.
  • 25. • Example program: • import java.applet.Applet; • import java.awt.Graphics; • import java.awt.Image; • public class AppletImage extends Applet • { • Image img; • public void init() • { • img=getImage(getDocumentBase(),getParameter("img")); • } • public void paint(Graphics g) • { • g.drawImage(img,0,0,this); • g.drawImage(img,150,150,300,140,this);//scaled image. • } • } • Html file • html> • <applet code="AppletImage.class" height=300 width=300> <param name="img" value="java.png"> </applet> • </html> • Output:
  翻译: