Previous | Next | Trail Map | JavaBeans Tutorial | BeanBox Basics


Starting and Using the BeanBox

The beans/beanbox. directory contains Windows (run.bat) and Unix (run.sh) scripts that start the BeanBox. You can use these commands to start the BeanBox, or use make:

gnumake run
Or:
nmake run

See the BDK files beans/doc/makefiles.html and beans/doc/gnu.txt for information about getting copies of these make tools.

When started, the BeanBox displays three windows: The BeanBox, ToolBox, and the Properties sheet. Here's how they look:

This illustration shows the BeanBox with the Juggler demo Bean placed within it. The hatching around the Juggler is how the BeanBox indicates the selected Bean. Clicking on a Bean selects it.

Adding a Bean to the ToolBox

The ToolBox contains the Beans available for use by the BeanBox. When the BeanBox is started, it automatically loads all the Beans it finds within the JAR files contained in the beans/jars directory. Move your JAR files into that directory to have them automatically loaded at BeanBox startup. Load Beans from JAR files located elsewhere by using the File|LoadJar... BeanBox menu item. Clicking on a Bean name within the ToolBox chooses that Bean for placement within the BeanBox. You will see the cursor change to a crosshair.

Dropping a Bean on the BeanBox

To add a JellyBean to the BeanBox

  1. Click on the word JellyBean in the ToolBox. The cursor will change to a crosshair.
  2. Click within the BeanBox. The JellyBean will appear and will be selected.

Note the change in the Properties sheet when you put the JellyBean in the BeanBox. Before you placed the JellyBean in the BeanBox, the BeanBox's properties were displayed; after placing the JellyBean in the BeanBox, the JellyBean properties are displayed. If you missed the change, click within the BeanBox, away from the JellyBean. This will select the BeanBox rather than the JellyBean. The Properties sheet will then display the BeanBox's properties.

The Properties sheet displays the selected Bean's properties. After dropping a JellyBean instance on the BeanBox, the Properties sheet displays the JellyBean properties: color, foreground, priceInCents, background, and font.

Editing Bean Properties

The Properties sheet displays each property's name and its current value. Values are displayed in an editable text field (strings and numbers), a choice menu (booleans), or as painted values (colors and fonts). You can edit the property value by clicking on a property within the Properties sheet. Properties displayed in text fields or choice menus are edited within the Properties sheet. When you click on a color or font property a separate panel, called a property editor, will pop up to do the editing. These property types use a custom property editor. Try clicking on each of the JellyBean properties.

Saving and Restoring Beans

The BeanBox uses Java Object Serialization to save and restore Beans and their state. The following steps demonstrate how to save and restore a Bean:

  1. Drop a JellyBean on the BeanBox.
  2. Change the color property to anything you want.
  3. Select the File|Save BeanBox menu item. A file browser will pop up; use it to save the Bean to a file.
  4. Select the File|Clear BeanBox menu item.
  5. Select the File|Load BeanBox menu item. The file browser will again pop up; use it to retrieve the serialized Bean.

In the next lesson you learn more BeanBox capabilities by creating a simple Bean.


Previous | Next | Trail Map | JavaBeans Tutorial | BeanBox Basics