There is no program to write for this Magercise. Instead, the goal is to
become familiar with the BDK's BeanBox. The principal task is to connect
"Start" and "Stop" command-button Beans to a juggler Bean
to control the juggling activity.
Start the BeanBox, either from a command shell or a graphical file navigator
such as Windows Explorer.
With a command shell, change directories to the BDK installation directory.
From there, change directories to the beanbox
subdirectory and
execute run.bat
(Windows) or run.sh
(UNIX). The run
script will start the BeanBox. Also, from Windows Explorer you can simply
navigate to the beanbox
directory and double-click run
. Note
that for some releases of the BDK, the Windows install program automatically
adds a BDK/BeanBox entry to the Start
menu.
The BeanBox consists of three windows: the palette, the worksheet area, and the
property sheet for the currently selected Bean. The palette and property sheet
windows appear only in design mode. To hide/show them, select the design-mode
menu item under the "View" menu. For this Magercise, they should be
visible.
If you are using BDK 1.1, you get an optional fourth window, called the method
tracer.
The currently selected Bean has a dashed line around it (initially, the
worksheet object itself). The property sheet lists the properties for the
currently selected Bean. To change a property, first select it from the sheet.
Selecting a property activates a custom property editor, if available;
otherwise, it simply sets the focus to the text-field object for text-oriented
property specification.
For example, if you click on the "background" property, the BeanBox
will activate a color editor. If you click on the "Abcde..."
property, it will activate a font editor. The "name" property allows
you to set an instance name for the currently selected object.
For now, simply change the background color of the worksheet to white.
To place something on the worksheet, select it from the palette (with a single
mouse click) and place it on the worksheet (with a second single mouse click).
First, experiment with one of the command buttons. You can then try several
other Beans.
Next, take a look at the ExplicitButton
Bean. First, add an instance
of this Bean to the worksheet. Then, choose "Report" from the
"Edit" menu. Note the descriptive data that is displayed in the
command window where you started the BeanBox. Optionally, if you are familiar
with command window operations for redirecting output to a file, capture the
output to a text file and examine it.
Next, clear out the BeanBox to prepare for the main task, configuring a
juggler Bean with two controls. Simply select "Clear" from the
"File" menu. (Note that the BeanBox doesn't warn you that the
worksheet contents have not been saved. You can also accidentally exit the
BeanBox without getting a save-your-work prompt--you will lose whatever work
you've done.)
The next task is to configure start and stop controls for a Juggler
Bean. First, select and place a Juggler
and two OurButton
Beans on the worksheet.
Next, change the label for either OurButton
Bean to "Start"
and connect its action-performed functionality to the Juggler
Bean's
start-juggling functionality.
Next, change the label for the other OurButton
Bean to
"Stop" and connect its action-performed functionality to the
Juggler
Bean's stop-juggling functionality. After setting up these
connections, you will be able to use the two command buttons to control the
juggling operation.
Lastly, you can save your work as an applet using the
"MakeApplet..." command, to use it outside the BeanBox.
You can now exit the BeanBox and run the applet with appletviewer
from the directory where you saved it.
There is no program to write for this Magercise. Instead, the goal is to become familiar with the BDK's BeanBox. The BeanBox looks similar to the following, except with larger windows covering much of the desktop: