Java Beans is an architecture and platform independent set of classed for creating and using Java software components. Beans are building blocks for creating applications. There can be visual beans like sliders, buttons, menulist and so on. Beans can be invisible too, these are beans which are used to receive an event and work behind the scenes. Beans supports the software component model which focuses on the use of components and containers.
Contents
Components
Components are specialized, self contained software entities that can be replicated, customized and inserted into applications and applets.
Containers
Containers are components that contain other components. Containers can be used as a framework for visually organizing components. Visual development tools allow components to be dragged and dropped into a container, resized and positioned.
Bean Development Kit (BDK)
Installing the BDK
The JDK must be installed on a computer in order for the BDK to work. The winodows version of the BDK is available as a self installing executable file. Just double click the files icon to start the installation program. Follow the instructions and install it in the default directory (C:\bdk).
Starting the BeanBox
The BeanBox is located in the c:\bdk\beanbox directory. To start the BeanBox these steps are to be followed:
- Change to the directory C:\bdk\beanbox.
- Execute the batch file called run.bat
-
This cause the BDK to display the three windows shown in the diagram 25.2. The ToolBox lists all the different Beans that have been installed on the computer with the BDK. The Bean Box provides an area to layout and connect the Beans selected from the ToolBox. Properties provide the ability to configure a selected Bean.
|
Bean Development Kit |
|
Click the Juggler Bean in the ToolBox window and then click in the BeanBox: the Juggler Bean is placed in the BeanBox. The Bean starts juggling. The property sheet of the Juggler Bean is displayed. The Bean can be customized by changing its properties.
|
Adding a Bean |
|
To add a button to the BeanBox click an OurButton Bean in the ToolBox and then click in the BeanBox. Use the property sheet to set the following properties:
Property Name | Value |
Label | Start |
Background | Note1 |
|
Adding a Start Button |
|
In a Similar manner the Stop button is added to the BeanBox.
|
Adding a Stop Button |
|
These Start and Stop buttons have added to control the juggler's animation. For this connect the Start button's actionPerformed() event handler to the startJuggler() method of the JugglerBean and the Stop button's actionPerformed() event handler to stopJuggling() method of the Juggler Bean.
To achieve this Start button has to be selected and the select Edit|Event|Action|ActionPerformed, from the BeanBox member.
|
Selecting the actionPerformed() event handler |
|
As soon as this is done a line (red) is visible from the Start button. This line represents the logical connection from the Start button's actionPerformed() event handler to the Juggler. Click inside the Juggler Bean to close the connection.
|
Connecting the event handler to the Juggler |
|
On doing so, the EventTargetDialog Box is displayed. This dialog box lits the interface methods of the Juggler Bean. Select startJuggling() method. By doing so, the clicking of Start Button gets connected to the startJuggling() method, via the actionPerformed() event handler of the 'start' button Bean.
|
Connecting to the start juggling method. |
|
The EventTargetDialog Box notifies that it is compiling an adapter class. The BeanBox creates a special class called and adapter class, to connect the click of the Start button with the startJuggling() method of the Juggler. The BeanBox must compile this class and add it to the running BeanBox to support this connection.
In a similar fashion connect the click of the Stop button to the stopJuggling() method.
Now the Juggler is ready to act.
Understanding the Sample Beans
Just to whet your appetite, what follows is a short description of the Beans that are in the ToolBox.
Blue Button | A simple button with background, foreground, label and font properties. |
Orange Button | A simple button with background, foreground, label and font properties. |
Out Button | A grey button with additional font properties. |
Explicit Button | A simple button with background, foreground, label and font properties. |
Jelly Bean | A simple visual component that draws a colored oval "jelly bean". |
Voter | Designed to handle a vetoableChange event. By default the Bean will reject all change requests, but change requests will be accepted if the vetoAll property is set to false. |
ChangeReporter | A textfiled. |
Molecule | Similar to Juggler in concept. The Bean displays a 3-D representation of a molecule and accepts mouse input to rotate the molecule. |
QuoteMonitor | Uses RMI to contact a remote (or local) quote server and request a real or imaginary stock quote value. |
JDBC Select | Uses the JDBC API to connect to a database at a specified URL and issue a select statement. |
BridgeTester | Provides a set of property types and events that may be used to test other bean components. |
This information is really useful to me.
ReplyDeleteJava Training in Velachery
i run the run.bat file in command prompt but it displayed java is not recognized as internal or external command
ReplyDelete