SlideShare a Scribd company logo
Internet Technologies- JavaBeans 
Java Beans
Internet Technologies- JavaBeans 
Tuesday, November 18, 2014 
2 
Components 
• Hardware components of Integrated 
Circuits – Resistors, Capacitors and 
Inductors 
• All of these components can be reused in 
different type of circuits 
• Software components – buttons, 
textboxes, checkboxes, radio buttons 
• The above mentioned components can be 
used in the following applications: 
– Calculator 
– Railway reservation system 
– Online polling system etc.,
Internet Technologies- JavaBeans 
Tuesday, November 18, 2014 
3 
Components Assembly 
• Assembly is one of the key features of Java Bean 
though no not specific solution is provided. 
– Different ways of assembling components are 
supplied. 
Component-based assembly Heterogeneous assembly
Internet Technologies- JavaBeans 
Tuesday, November 18, 2014 
4 
What are beans? 
• Reusable Java code 
• Easiest to reuse is static objects; 
– Ex: Text fields, buttons 
– Available as third-party products 
– Limited interaction with environment 
– The functionality does not change 
• Can be composed into complex beans 
• Drag-and-drop using application 
construction tools
Internet Technologies- JavaBeans 
Tuesday, November 18, 2014 
5 
What is a Java Bean? 
• A component technology for Java that 
allows a developer to create reusable 
software objects. 
• A Java Bean is a reusable software 
component that can be visually 
manipulated in builder tools( during the 
software development). 
• A Java Bean is a software component that 
has been designed to be reusable in a 
variety of different environments.
Internet Technologies- JavaBeans 
Tuesday, November 18, 2014 
6 
Advantages of Java Beans 
• Obtains all the benefits of Java (write-once, run-anywhere) 
• The properties, events and methods of a bean 
that are exposed to an application builder tool can 
be controlled 
• A Bean may be designed to operate correctly in 
different locales 
• Auxiliary software can be provided to help a 
person configure a Bean 
• The configuration settings of a Bean can be saved 
in persistent storage and restored at a later time 
• A Bean may register to receive events from other 
objects and can generate events that are sent to 
other objects
Internet Technologies- JavaBeans 
Tuesday, November 18, 2014 
7 
Application Builder Tools 
• A utility that enables the user to configure 
a set of Beans, connect them together, 
and produce a working application 
– A palette is provided that lists all of the 
available Beans 
– A worksheet is displayed that allows the 
designer to lay out Beans in a GUI. A designer 
may drag and drop a Bean from the palette to 
this worksheet 
– Special editors and customizers allow a Bean 
to be configured 
– Commands allow a designer to inquire about 
the state and behavior of a Bean 
– Capabilities exist to interconnect beans
Internet Technologies- JavaBeans 
Tuesday, November 18, 2014 
8 
Design Patterns for Properties 
A property is a subset of a Bean’s state 
• Simple properties 
• Boolean properties 
• Indexed properties
Internet Technologies- JavaBeans 
Tuesday, November 18, 2014 
9 
Simple and Boolean properties 
// member used to store property value // 
private String internalString; 
// set and get method for property named String // 
public void setString(String newValue) 
{ internalString = newValue; } 
public String getString() 
{ return internalString; } 
// member used to store property value // 
private boolean connect; 
// set and get method for boolean property name connected // 
public void setConnected(boolean newValue) 
{ connect = newValue; } 
public boolean isConnected(} { return connect; }
Internet Technologies- JavaBeans 
Tuesday, November 18, 2014 
10 
Indexed properties 
• An indexed property represent a 
array of values. And we can use 
additional get and set methods for an 
indexed property. This get and set 
method take an integer index 
parameter. This index parameter 
indicates the place in the array where 
the new property value has to be put.
Internet Technologies- JavaBeans 
Tuesday, November 18, 2014 
11 
Indexed properties 
// member to store indexed property // 
private int[] numbers = {1, 2, 3, 4}; 
// set and get method for complete array // 
public void setNumbers(int[] newValue) 
{ 
numbers = newValue; 
} 
public int[] getNumbers() 
{ 
return numbers; 
}
Internet Technologies- JavaBeans 
Indexed properties 
Tuesday, November 18, 2014 
12 
// set and get method with index to set one element 
of array // 
public void setNumbers(int index, int newValue) 
{ 
numbers[index] = newValue; 
} 
public int getNumbers(int index) 
{ 
return numbers[index]; 
}
Internet Technologies- JavaBeans 
Tuesday, November 18, 2014 
13 
Bean Class 
A bean is a Java class that: 
– Has a void constructor 
– Has private instance variables with setter and getter 
– Methods 
public class SimpleBean 
{ 
private int counter; 
SimpleBean() {counter=0;} 
int getCounter() {return counter;} 
void setCounter(int c) {counter=c;} 
}
Internet Technologies- JavaBeans 
Tuesday, November 18, 2014 
14
Internet Technologies- JavaBeans 
Tuesday, November 18, 2014 
15 
Steps involved in Creating a Java Bean 
a. Write the SimpleBean code. 
b. Create a manifest, the JAR file, and the class 
file SimpleBean.class. 
c. Load the JAR file (using NetBeans) 
– Start NetBeans. 
– From the File menu select "New Project" to create a new 
application for your bean. You can use "Open Project" to 
add your bean to an existing application. 
– Create a new application using the New Project Wizard. 
– Select a newly created project in the List of Projects, 
expand the Source Packages node, and select the 
Default Package element. 
– Click the right mouse button and select New|JFrameForm 
from the pop-up menu. 
– Select the newly created Form node in the Project Tree. 
A blank form opens in the GUI Builder view of an Editor 
tab.
Internet Technologies- JavaBeans 
Tuesday, November 18, 2014 
16 
Steps involved in Creating a Java Bean 
continued 
– Open the Palette Manager for Swing/AWT 
components by selecting Palette Manager in the Tools 
menu. 
– In the Palette Manager window select the beans 
components in the Palette tree and press the "Add 
from JAR" button. 
– Specify a location for your SimpleBean JAR file and 
follow the Add from JAR Wizard instructions. 
– Select the Palette and Properties options from the 
Windows menu. 
– Expand the beans group in the Palette window. The 
SimpleBean object appears. Drag the SimpleBean 
object to the GUI Builder panel. 
d. Inspect Properties and Events
Internet Technologies- JavaBeans 
Tuesday, November 18, 2014 
17 
JAR Files 
– A JAR file allows to efficiently deploy a 
set of classes and their associated 
resources 
– Elements in a JAR file are compressed 
– Digital signatures may also be 
associated with the individual elements 
in a JAR file
Internet Technologies- JavaBeans 
Tuesday, November 18, 2014 
18 
Manifest Files 
– To indicate which of the components in a JAR 
file are Java Beans 
– Example 
• d:/demo/one.gif 
• d:/demo/two.gif 
• d:/demo/three.gif 
• d:/demo/one.class 
Java- Bean:True 
– A manifest file may reference several .class 
files. If a .class file is a Java Bean, its entry 
must be immediately followed by the line 
“Java- Bean:True”.
Internet Technologies- JavaBeans 
Tuesday, November 18, 2014 
19 
Deployed Bean 
import java.awt.Color; 
import javax.swing.JLabel; 
import java.io.Serializable; 
public class SimpleBean extends JLabel 
implements Serializable { 
public SimpleBean() { 
setText( "Hello world!" ); 
setOpaque( true ); 
setBackground( Color.BLUE ); 
setForeground( Color.YELLOW ); 
} 
}

More Related Content

PPTX
Javabeans
vamsitricks
 
PPT
Java beans
Ramraj Choudhary
 
PPT
Java beans
sptatslide
 
PPTX
Unit iv
bhushan_adavi
 
PPTX
Java beans
Rajkiran Mummadi
 
PDF
Javabeans .pdf
Rajkiran Mummadi
 
PDF
13 java beans
snopteck
 
PDF
javabeans
Arjun Shanka
 
Javabeans
vamsitricks
 
Java beans
Ramraj Choudhary
 
Java beans
sptatslide
 
Unit iv
bhushan_adavi
 
Java beans
Rajkiran Mummadi
 
Javabeans .pdf
Rajkiran Mummadi
 
13 java beans
snopteck
 
javabeans
Arjun Shanka
 

What's hot (20)

PPT
introduction of Java beans
shravan kumar upadhayay
 
PPT
Javabean1
Saransh Garg
 
PDF
Java beans
Mukesh Tekwani
 
PPT
Introduction to java beans
Hitesh Parmar
 
PPT
Bean Intro
vikram singh
 
PPTX
Java Beans
Ankit Desai
 
PPTX
Unit4wt
vamsi krishna
 
PPTX
enterprise java bean
Jitender Singh Lodhi
 
PDF
0012
none
 
PPTX
Session bean
sandeep54552
 
PPTX
Ejb3.1 for the starter
shohancse
 
PPSX
Entity beans in java
Acp Jamod
 
PDF
Ejb3 Presentation
Saurabh Raisinghani
 
PPT
EJB .
ayyagari.vinay
 
PDF
Contextual Dependency Injection for Apachecon 2010
Rohit Kelapure
 
PDF
EJB 3.0 and J2EE
Aniruddha Ray (Ani)
 
PPTX
Enterprise Java Beans 3 - Business Logic
Emprovise
 
PPTX
Spring framework
Rajkumar Singh
 
PDF
Ejb notes
Mumbai Academisc
 
introduction of Java beans
shravan kumar upadhayay
 
Javabean1
Saransh Garg
 
Java beans
Mukesh Tekwani
 
Introduction to java beans
Hitesh Parmar
 
Bean Intro
vikram singh
 
Java Beans
Ankit Desai
 
Unit4wt
vamsi krishna
 
enterprise java bean
Jitender Singh Lodhi
 
0012
none
 
Session bean
sandeep54552
 
Ejb3.1 for the starter
shohancse
 
Entity beans in java
Acp Jamod
 
Ejb3 Presentation
Saurabh Raisinghani
 
Contextual Dependency Injection for Apachecon 2010
Rohit Kelapure
 
EJB 3.0 and J2EE
Aniruddha Ray (Ani)
 
Enterprise Java Beans 3 - Business Logic
Emprovise
 
Spring framework
Rajkumar Singh
 
Ejb notes
Mumbai Academisc
 
Ad

Viewers also liked (7)

PPTX
Santa Ana School.pptx
sofiathoma
 
PPT
Java Networking
Ankit Desai
 
PDF
EJB 3.1 by Bert Ertman
Stephan Janssen
 
PDF
Java beans
Ravi Kant Sahu
 
PPT
Korčulanska Liga - Žrnovo
korculanskaliga
 
PDF
Enterprise JavaBeans(EJB)
Armen Arzumanyan
 
Santa Ana School.pptx
sofiathoma
 
Java Networking
Ankit Desai
 
EJB 3.1 by Bert Ertman
Stephan Janssen
 
Java beans
Ravi Kant Sahu
 
Korčulanska Liga - Žrnovo
korculanskaliga
 
Enterprise JavaBeans(EJB)
Armen Arzumanyan
 
Ad

Similar to Beans presentation (20)

PPTX
Unit4wt
vamsitricks
 
PPT
web programmimg- concpt in JAVABEANS.ppt
mcjaya2024
 
PPTX
Ordina Accelerator program 2019 - Maven
Bert Koorengevel
 
PDF
Maven2交流
ChangQi Lin
 
KEY
Tycho - good, bad or ugly ?
Max Andersen
 
PPT
JSP Part 2
DeeptiJava
 
PDF
Net Beans61 Platform
satyajit_t
 
PPTX
Session 4 - Understanding JAVA Beans.pptx
imjdabhinawpandey
 
PPT
Maven: Managing Software Projects for Repeatable Results
Steve Keener
 
PDF
Android intents-3 www.j2program.blogspot.com
Mohamed Rimzan
 
PDF
JMP402 Master Class: Managed beans and XPages: Your Time Is Now
Russell Maher
 
PPTX
SenchaCon 2016: Building Enterprise Ext JS Apps with Mavenized Sencha Cmd - F...
Sencha
 
PPTX
Introduction to Maven for beginners and DevOps
SISTechnologies
 
PPTX
Codename BEAN.pptx
MusicArena1
 
PDF
The Virtual Repository
Fabio Simeoni
 
PPTX
Spring data jpa are used to develop spring applications
michaelaaron25322
 
PDF
Monorepo: React Web & React Native
Eugene Zharkov
 
PDF
01 spring-intro
hossein helali
 
PPTX
1. react - native: setup
Govind Prasad Gupta
 
PPTX
Apache Maven
venkatraghavang
 
Unit4wt
vamsitricks
 
web programmimg- concpt in JAVABEANS.ppt
mcjaya2024
 
Ordina Accelerator program 2019 - Maven
Bert Koorengevel
 
Maven2交流
ChangQi Lin
 
Tycho - good, bad or ugly ?
Max Andersen
 
JSP Part 2
DeeptiJava
 
Net Beans61 Platform
satyajit_t
 
Session 4 - Understanding JAVA Beans.pptx
imjdabhinawpandey
 
Maven: Managing Software Projects for Repeatable Results
Steve Keener
 
Android intents-3 www.j2program.blogspot.com
Mohamed Rimzan
 
JMP402 Master Class: Managed beans and XPages: Your Time Is Now
Russell Maher
 
SenchaCon 2016: Building Enterprise Ext JS Apps with Mavenized Sencha Cmd - F...
Sencha
 
Introduction to Maven for beginners and DevOps
SISTechnologies
 
Codename BEAN.pptx
MusicArena1
 
The Virtual Repository
Fabio Simeoni
 
Spring data jpa are used to develop spring applications
michaelaaron25322
 
Monorepo: React Web & React Native
Eugene Zharkov
 
01 spring-intro
hossein helali
 
1. react - native: setup
Govind Prasad Gupta
 
Apache Maven
venkatraghavang
 

Recently uploaded (20)

PPTX
Virus sequence retrieval from NCBI database
yamunaK13
 
PDF
Health-The-Ultimate-Treasure (1).pdf/8th class science curiosity /samyans edu...
Sandeep Swamy
 
PPTX
Continental Accounting in Odoo 18 - Odoo Slides
Celine George
 
PDF
Module 2: Public Health History [Tutorial Slides]
JonathanHallett4
 
PPTX
How to Apply for a Job From Odoo 18 Website
Celine George
 
PPTX
Introduction to pediatric nursing in 5th Sem..pptx
AneetaSharma15
 
PPTX
An introduction to Prepositions for beginners.pptx
drsiddhantnagine
 
DOCX
pgdei-UNIT -V Neurological Disorders & developmental disabilities
JELLA VISHNU DURGA PRASAD
 
PPTX
CDH. pptx
AneetaSharma15
 
DOCX
SAROCES Action-Plan FOR ARAL PROGRAM IN DEPED
Levenmartlacuna1
 
PPTX
20250924 Navigating the Future: How to tell the difference between an emergen...
McGuinness Institute
 
PPTX
CARE OF UNCONSCIOUS PATIENTS .pptx
AneetaSharma15
 
PPTX
INTESTINALPARASITES OR WORM INFESTATIONS.pptx
PRADEEP ABOTHU
 
PPTX
Command Palatte in Odoo 18.1 Spreadsheet - Odoo Slides
Celine George
 
PDF
Antianginal agents, Definition, Classification, MOA.pdf
Prerana Jadhav
 
PPTX
Artificial-Intelligence-in-Drug-Discovery by R D Jawarkar.pptx
Rahul Jawarkar
 
PPTX
Sonnet 130_ My Mistress’ Eyes Are Nothing Like the Sun By William Shakespear...
DhatriParmar
 
PPTX
An introduction to Dialogue writing.pptx
drsiddhantnagine
 
PDF
The-Invisible-Living-World-Beyond-Our-Naked-Eye chapter 2.pdf/8th science cur...
Sandeep Swamy
 
PPTX
Gupta Art & Architecture Temple and Sculptures.pptx
Virag Sontakke
 
Virus sequence retrieval from NCBI database
yamunaK13
 
Health-The-Ultimate-Treasure (1).pdf/8th class science curiosity /samyans edu...
Sandeep Swamy
 
Continental Accounting in Odoo 18 - Odoo Slides
Celine George
 
Module 2: Public Health History [Tutorial Slides]
JonathanHallett4
 
How to Apply for a Job From Odoo 18 Website
Celine George
 
Introduction to pediatric nursing in 5th Sem..pptx
AneetaSharma15
 
An introduction to Prepositions for beginners.pptx
drsiddhantnagine
 
pgdei-UNIT -V Neurological Disorders & developmental disabilities
JELLA VISHNU DURGA PRASAD
 
CDH. pptx
AneetaSharma15
 
SAROCES Action-Plan FOR ARAL PROGRAM IN DEPED
Levenmartlacuna1
 
20250924 Navigating the Future: How to tell the difference between an emergen...
McGuinness Institute
 
CARE OF UNCONSCIOUS PATIENTS .pptx
AneetaSharma15
 
INTESTINALPARASITES OR WORM INFESTATIONS.pptx
PRADEEP ABOTHU
 
Command Palatte in Odoo 18.1 Spreadsheet - Odoo Slides
Celine George
 
Antianginal agents, Definition, Classification, MOA.pdf
Prerana Jadhav
 
Artificial-Intelligence-in-Drug-Discovery by R D Jawarkar.pptx
Rahul Jawarkar
 
Sonnet 130_ My Mistress’ Eyes Are Nothing Like the Sun By William Shakespear...
DhatriParmar
 
An introduction to Dialogue writing.pptx
drsiddhantnagine
 
The-Invisible-Living-World-Beyond-Our-Naked-Eye chapter 2.pdf/8th science cur...
Sandeep Swamy
 
Gupta Art & Architecture Temple and Sculptures.pptx
Virag Sontakke
 

Beans presentation

  • 2. Internet Technologies- JavaBeans Tuesday, November 18, 2014 2 Components • Hardware components of Integrated Circuits – Resistors, Capacitors and Inductors • All of these components can be reused in different type of circuits • Software components – buttons, textboxes, checkboxes, radio buttons • The above mentioned components can be used in the following applications: – Calculator – Railway reservation system – Online polling system etc.,
  • 3. Internet Technologies- JavaBeans Tuesday, November 18, 2014 3 Components Assembly • Assembly is one of the key features of Java Bean though no not specific solution is provided. – Different ways of assembling components are supplied. Component-based assembly Heterogeneous assembly
  • 4. Internet Technologies- JavaBeans Tuesday, November 18, 2014 4 What are beans? • Reusable Java code • Easiest to reuse is static objects; – Ex: Text fields, buttons – Available as third-party products – Limited interaction with environment – The functionality does not change • Can be composed into complex beans • Drag-and-drop using application construction tools
  • 5. Internet Technologies- JavaBeans Tuesday, November 18, 2014 5 What is a Java Bean? • A component technology for Java that allows a developer to create reusable software objects. • A Java Bean is a reusable software component that can be visually manipulated in builder tools( during the software development). • A Java Bean is a software component that has been designed to be reusable in a variety of different environments.
  • 6. Internet Technologies- JavaBeans Tuesday, November 18, 2014 6 Advantages of Java Beans • Obtains all the benefits of Java (write-once, run-anywhere) • The properties, events and methods of a bean that are exposed to an application builder tool can be controlled • A Bean may be designed to operate correctly in different locales • Auxiliary software can be provided to help a person configure a Bean • The configuration settings of a Bean can be saved in persistent storage and restored at a later time • A Bean may register to receive events from other objects and can generate events that are sent to other objects
  • 7. Internet Technologies- JavaBeans Tuesday, November 18, 2014 7 Application Builder Tools • A utility that enables the user to configure a set of Beans, connect them together, and produce a working application – A palette is provided that lists all of the available Beans – A worksheet is displayed that allows the designer to lay out Beans in a GUI. A designer may drag and drop a Bean from the palette to this worksheet – Special editors and customizers allow a Bean to be configured – Commands allow a designer to inquire about the state and behavior of a Bean – Capabilities exist to interconnect beans
  • 8. Internet Technologies- JavaBeans Tuesday, November 18, 2014 8 Design Patterns for Properties A property is a subset of a Bean’s state • Simple properties • Boolean properties • Indexed properties
  • 9. Internet Technologies- JavaBeans Tuesday, November 18, 2014 9 Simple and Boolean properties // member used to store property value // private String internalString; // set and get method for property named String // public void setString(String newValue) { internalString = newValue; } public String getString() { return internalString; } // member used to store property value // private boolean connect; // set and get method for boolean property name connected // public void setConnected(boolean newValue) { connect = newValue; } public boolean isConnected(} { return connect; }
  • 10. Internet Technologies- JavaBeans Tuesday, November 18, 2014 10 Indexed properties • An indexed property represent a array of values. And we can use additional get and set methods for an indexed property. This get and set method take an integer index parameter. This index parameter indicates the place in the array where the new property value has to be put.
  • 11. Internet Technologies- JavaBeans Tuesday, November 18, 2014 11 Indexed properties // member to store indexed property // private int[] numbers = {1, 2, 3, 4}; // set and get method for complete array // public void setNumbers(int[] newValue) { numbers = newValue; } public int[] getNumbers() { return numbers; }
  • 12. Internet Technologies- JavaBeans Indexed properties Tuesday, November 18, 2014 12 // set and get method with index to set one element of array // public void setNumbers(int index, int newValue) { numbers[index] = newValue; } public int getNumbers(int index) { return numbers[index]; }
  • 13. Internet Technologies- JavaBeans Tuesday, November 18, 2014 13 Bean Class A bean is a Java class that: – Has a void constructor – Has private instance variables with setter and getter – Methods public class SimpleBean { private int counter; SimpleBean() {counter=0;} int getCounter() {return counter;} void setCounter(int c) {counter=c;} }
  • 14. Internet Technologies- JavaBeans Tuesday, November 18, 2014 14
  • 15. Internet Technologies- JavaBeans Tuesday, November 18, 2014 15 Steps involved in Creating a Java Bean a. Write the SimpleBean code. b. Create a manifest, the JAR file, and the class file SimpleBean.class. c. Load the JAR file (using NetBeans) – Start NetBeans. – From the File menu select "New Project" to create a new application for your bean. You can use "Open Project" to add your bean to an existing application. – Create a new application using the New Project Wizard. – Select a newly created project in the List of Projects, expand the Source Packages node, and select the Default Package element. – Click the right mouse button and select New|JFrameForm from the pop-up menu. – Select the newly created Form node in the Project Tree. A blank form opens in the GUI Builder view of an Editor tab.
  • 16. Internet Technologies- JavaBeans Tuesday, November 18, 2014 16 Steps involved in Creating a Java Bean continued – Open the Palette Manager for Swing/AWT components by selecting Palette Manager in the Tools menu. – In the Palette Manager window select the beans components in the Palette tree and press the "Add from JAR" button. – Specify a location for your SimpleBean JAR file and follow the Add from JAR Wizard instructions. – Select the Palette and Properties options from the Windows menu. – Expand the beans group in the Palette window. The SimpleBean object appears. Drag the SimpleBean object to the GUI Builder panel. d. Inspect Properties and Events
  • 17. Internet Technologies- JavaBeans Tuesday, November 18, 2014 17 JAR Files – A JAR file allows to efficiently deploy a set of classes and their associated resources – Elements in a JAR file are compressed – Digital signatures may also be associated with the individual elements in a JAR file
  • 18. Internet Technologies- JavaBeans Tuesday, November 18, 2014 18 Manifest Files – To indicate which of the components in a JAR file are Java Beans – Example • d:/demo/one.gif • d:/demo/two.gif • d:/demo/three.gif • d:/demo/one.class Java- Bean:True – A manifest file may reference several .class files. If a .class file is a Java Bean, its entry must be immediately followed by the line “Java- Bean:True”.
  • 19. Internet Technologies- JavaBeans Tuesday, November 18, 2014 19 Deployed Bean import java.awt.Color; import javax.swing.JLabel; import java.io.Serializable; public class SimpleBean extends JLabel implements Serializable { public SimpleBean() { setText( "Hello world!" ); setOpaque( true ); setBackground( Color.BLUE ); setForeground( Color.YELLOW ); } }