Home | » | Java | » | Advance Java | » | Java Beans | » | Using Java BeanBox |
---|
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.
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:
In a Similar manner the Stop button is added to the BeanBox.
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.
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.
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.
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.
|
Diagram 25.3 Adding a Bean |
|
|
Diagram 25.4 Adding a Start Button |
|
Diagram 25.5 Adding a Stop Button |
|
Diagram 25.6 Selecting the actionPerformed() event handler |
|
Diagram 25.7 Connecting the event handler to the Juggler |
|
Diagram 25.8 Connecting to the start juggling method. |
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. |
It was such a great article.
ReplyDeleteJava Training in chennai
This comment has been removed by the author.
ReplyDeleteGood Post! Thank you so much for sharing the post, it was so good to read and useful to improve
ReplyDeleteJava Training in Electronic City
Thank you for sharing useful information with us. please keep sharing like this. And if you are searching a unique and Top University in India, Colleges discovery platform, which connects students or working professionals with Universities/colleges, at the same time offering information about colleges, courses, entrance exam details, admission notifications, scholarships, and all related topics. Please visit below links:
ReplyDeleteManav Rachna International Institute of Research and Studies Faridabad
NIMS University Jaipur
Nirma University Ahmedabad
PES University Bangalore
Rabindranath Tagore University Bhopal