This section gives you a brief, introductory look at
the BeanBox and it's basic operation.
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 a
make utility:
| Platform | Command |
|---|---|
| Unix | gmake run |
| Windows | nmake run |
See the BDK files beans/doc/makefiles.html and
beans/doc/gnu.txt for information about
getting copies of gnumake and nmake.
When started, the BeanBox displays three windows: The ToolBox, the BeanBox window, and the Properties sheet.
Here are brief descriptions of each window.
Juggler Bean instance dropped in it. Later you'll
see how to wire the Juggler to two button
Beans that start and stop him juggling.
You select among Beans in the BeanBox window simply
by clicking on the Bean. The selected Bean will have
a hatced border, as the Juggler Bean does in
the above screenshot. Which Bean is selected has significance
for the Properties sheet.
Juggler Bean's properties. If you drop
another Bean in the BeanBox
window, the properties sheet will display that Bean's properties.
When the BeanBox is started, it automatically loads the ToolBox with all the Beans it finds within the JAR files contained in the
beans/jarsdirectory. Move your JAR files into that directory to have them automatically loaded at BeanBox startup. You can 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. To drop a
JellyBeaninstance onto the BeanBox
- Click on the word
JellyBeanin the ToolBox. The cursor will change to a crosshair when flying over the BeanBox windows.- Click within the BeanBox. The
JellyBeaninstance will appear, and will be selected.Note the change in the Properties sheet when you put the
JellyBeanin the BeanBox. Before you placed theJellyBeanin the BeanBox, the BeanBox's properties were displayed. After placing theJellyBeanin the BeanBox, theJellyBeanproperties are displayed. If you missed the change, click within the BeanBox, away from theJellyBean. This will select the BeanBox rather than theJellyBean. The Properties sheet will then display the BeanBox's properties.After dropping a
JellyBeaninstance on the BeanBox, the Properties sheet displays theJellyBeanproperties:color,foreground,priceInCents,background, andfont.
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). Each property has an associated property editor. Clicking on a property within the Properties sheet activates the property's editor. Properties displayed in text fields or choice menus are edited within the Properties sheet. Because editing their values requires a more sophisticated user interface,
ColorandFontproperty types use a custom property editor. When you click on a color or font property a separate panel will pop up to do the editing. Try clicking on each of theJellyBeanproperties.
You can save the state of a Bean that your are customizing, and restore the Bean and its saved state at a later time. 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:
- Drop a
JellyBeanon the BeanBox.- Change the
colorproperty to anything you want.- Select the File|Save menu item. A file browser will pop up; use it to save the Bean to a file.
- Select the File|Clear menu item.
- Select the File|Load menu item. The file browser will again pop up; use it to retrieve the serialized Bean. The
JellyBeanwill be the color you chose.