What is BeanBox?
BeanBox is a test container in BDK. We can use BeanBox to create Application, Applet, and New
Beans. We can lay out, edit and interconnect beans visually. That is one of the benefits
of Javabeans is the capability for the beans to be used in visual application builder tools.
Before installing BDK, we have to install JDK version 1.1 or later first and then install BDK. There is a
"beanbox" directory insidne of BDK (assume "BDK" is a directory for JavaBeans"). BeanBox comes
with the batch file, called run.bat in the "beanbox" directory. If we type in "run", it would
displays 3 windows:
The second window is BeanBox, it is the main container window.
Last window is Propertysheet, it lists the properties associated with the current
selected bean. It is responsible for providing the visual editing capabilities of
the BeanBox.
The first window is Toolbox, it lists all the beans registered for use with BeaBox.
We also can write our own beans and add them to this window.
The following is the picture of the windows from
Starting and Using the BeanBox
What can BeanBox do?
The BeanBox allows you to: For more information The BeanBox
Using the BeanBox
Let's create a simple application using BeanBox. We are going to select "OurButton" from the
ToolBox window and place it somewhere in the BeanBox window. We are going to edit this bean in
the Propertysheet window, change the label to "Start". We are going to select another button,
and call it "Stop". Now let's get something exciting, select the "Juggler" bean. A useful
function of BeanBox is that we can wire beans together using events, we can do that visully,
this makes it very easy. Click the "Start" button, go to Edit and Event, select Action Event Menu
item, and then select Actionperformed. Now we can see a line originating from the "Start"
button that moves as the mouse moved around. We are going to move the mouse over the "Juggle"
bean. Click to connect the button bean's action event to the "Juggle" bean. Select "start Juggle"
method from Dialog box. We are going to do the same thing for "Stop" button. Now, we can click
"stop" and "start" to control the animation. We also can save the bean by using the save command.
If we clear this out, we can reload the application by opening it. This is a easy and fun to play with.
References:
Starting and Using the BeanBox
Java 1.1 Third Edition by Michael Morrison, er al.