Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
14Activity
0 of .
Results for:
No results containing your search query
P. 1
Java Beans

Java Beans

Ratings:

5.0

(1)
|Views: 248 |Likes:
Published by Adarsh

More info:

Published by: Adarsh on May 31, 2009
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less

10/01/2013

pdf

text

original

 
What are JavaBeans ?
A Bean is a reusable software component.JavaBeans is a set of reusable software components written in javaJavaBeans is a new technology that is used to construct applications by configuring and connecting components called Beans
Why JavaBeans
Beans can be created or can be got in binary format from vendorsThese building blocks need to be designed, coded and tested only onceand can be reused in multiple applications.Creating a Bean is just like creating any other java programJavaBeans led to a new type of programmer called the componentassembler who uses well defined components to create more functionality
JavaBeans the Self-Contained Component
JavaBeans adds to the Java platform the capability to create a completeapplication by simply linking together a set of self-contained componentsThere is no restriction on the size or complexity of a JavaBeans componentThe philosophy behind JavaBeans is to provide easy to implementfunctionality for the componentJavaBeans is based on the reuse and interoperability of Bean components
 
JavaBean1JavaBean2JavaBeanContainer Container 
JavaBeans and Containers
1
 
Concepts in Component Model
JavaBeans provides a platform neutral component architectureThe features of JavaBeans areComponent fields or propertiesComponent methods or functionsEvents and intercommunicationState persistence and storage
Component fields or properties
 A Component will have a set of properties that define its stateeg. A component to display textForeground color Type of fontSize of fontIf the properties of one component match that of another then they arein the same stateProperties not only define the appearance but also the behavior of componentsA component may not have any appearance at all but can have behavior eg. A component in a spreadsheet that calculates the interest earned onsome earning column but not capable of displaying the dataProperties can range from boolean values, strings, arrays to othecomponentsComponents can also be independent
Component methods or functions
 API of a component is the collection of methods or functions that itcontains so that other components and containers can callA container can modify a component’s properties and notify it as an eventDifferent component models differ in how they make properties andmethods of their components available to other components
Events and Intercommunication
 A component by itself is a lonely componentA component becomes useful when it is used in conjunction with other componentsThe method by which one component communicate with another component is event transmissionA component undergoes some action causing it to generate an eventAn event can also be generated when a button is clickedWhen an event happens the component will notify other interestedcomponents depending on the model2
 
State Persistence and Storage
 The components should remember their state and is very importantIf an application remembers the size and position of its window when itwas last closed it is maintaining a persistent stateThe capability to store and retrieve components is called packingIn a distributed environment where the components are served up ovea network it is important to store and retrieve components
The Basics of Designing a JavaBean
 Designing a Bean directly affects the way it behaves in a container The names chosen for the methods should follow specific designspecificationsIf the Bean is designed with proper rules then when the Bean participatein Introspection there will be no need for additional programmingDesigning a Bean consists of the following stepsSpecifying the Bean’s propertiesSpecifying the events the Bean generates or responds toDefining which properties, methods, and events the Bean exposes toother Beans or to its container Deciding miscellaneous issues, such as whether the Bean has its ownCustomization dialog box or whether it requires some prototypicalstate informationDesigning a Bean can be more explained with the help of an exampleThere are two Beans a Bean to enter text and another Bean to displaythe textThe two Beans are placed in a container so that one Bean can be used toenter text and the other Bean to display it.There can be a number of questions about the properties of the BeansThe first thing a Bean needs is a name and they are TextDisplayer andTextReader 
Specifying the Bean’s Properties
The TextDisplayerand TextReaderBeans should have property definingthe text they hold java.awt.Color FontColor 
TextDisplayerBean Properties
 java.awt.FontTextFont java.awt.Color BGColor  java.lang.StringOutputText
Java TypeProperty NameTextReaderBean Properties
intWidth java.lang.StringInputText
Java TypeProperty Name
3

Activity (14)

You've already reviewed this. Edit your review.
1 thousand reads
1 hundred reads
mydreamjob83 liked this
mensun liked this
Sunil Soni liked this
yadav123456 liked this
sukanya liked this
sujagane liked this

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->