Java Beans  «Prev  Next»
Lesson 4Beanbox Test Container
ObjectiveLearn the benefits of the BeanBox test container.

Benefits of the Beanbox Test Container

To run the BeanBox, execute the run.bat file, which is located in the beanbox directory beneath the main Bdk directory. The run.bat file makes use of the Java interpreter provided with the JDK. The Java interpreter is located in the JDK bin directory beneath the main jdk directory. This directory must be included in your system path in order for the run.bat file to function properly.

Getting to know the BeanBox

The ToolBox window displays all of the Beans installed in the BeanBox. These are the Beans available to be tested in the BeanBox and consist of the example Beans provided with the BDK. Notice that some of the Beans have graphical icons associated with them to make their usage a little more obvious. The ToolBox window is where you select Beans to be inserted in the BeanBox window for testing.


Diagram of ToolBox Window
Toolbox window displaying beans installed in the window.


The BeanBox user Interface

When the BeanBox is running, it displays three different windows:
  1. Properties window

The BeanBox Window

The BeanBox window is where Beans are inserted and tested. This window is similar to a form design window in an application builder tool in that you lay out Beans in the BeanBox window and visually manipulate them as desired. The BeanBox window also serves as the main application window for the BeanBox application since it contains the menu of available BeanBox commands.

Note that applets created via beans.instantiate run in a slightly different environment than applets running inside browsers. In particular, bean applets have no access to "parameters", so they may wish to provide property get and set methods to set parameter values. We advise bean-applet developers to test their bean-applets against both the JDK appletviewer (for a reference browser environment) and the BDK BeanBox (for a reference bean container).


The BeanBox Window

Beanbox Window

The BeanBox, from Oracle (formerly Sun Microsystems), eases the development of JavaBeans by providing a test container for the components. The BeanBox can test that the code you wrote for your bean works properly inside a container.


Raising and Handling of Events

An event is something of importance that happens at a specific point in time. An event can take place due to a user action such as
  1. a mouse click or
  2. when the user clicks a mouse button,
an event takes place. Events can also be initiated by other means. Imagine the heating system in your house. It contains a thermostat that sets the desired comfort temperature, keeps track of the current ambient temperature, and notifies the boiler when its services are required. If the thermostat is set to keep the room at 73 degrees Fahrenheit, it will notify the boiler to start producing heat if the temperature drops below that threshold. Components will send notifications to other objects when an event takes place in which those objects have expressed an interest.

In the next lesson you learn how to use the BeanBox to test Beans.