Help is available for each task.
Task 1
The first step is to create a working directory somewhere on your filesystem, hereafter referred to as workingdir.
To avoid confusion, create a new directory instead of using an existing directory that has existing/other files.
Task 2
Next, create the directory stickfigure (all lowercase characters) directly under workingdir.
To avoid subsequent confusion, create and verify that the directory name contains all lowercase characters. The directory stickfigure will house the StickFigure-related classes, which belong to the stickfigure package. The package and directory names must match exactly, and in some Bean-aware environments, they must be lowercase.
Task 3
Next, (1) save all the skeleton files, except the *.java files and GIF file, within workingdir and (2) save the *.java skeleton files and GIF file within stickfigure, that is, within workingdir/stickfigure.
Actually, the GIF file could be anywhere, but it is customary to locate it within the package directory, in this case, stickfigure.
Task 4
The next, and primary, task is to design and implement a customizer dialog for the body-part properties, the "sunburned" property, and the "mood" property. The skeleton code appears in StickFigureCustomizer.java. This class must extend a container class, for example, Panel and implement the Customizer interface.
The customization dialog should provide controls for each of the body-part properties, as well as for the "sunburned" property, for example, independent (nonexclusive) Checkbox instances organized in a nested panel. Also, it should provide a radio button-style control for the "mood" property.
You can use HireCustomizer as a model; note, however, that the controls are somewhat different. StickFigureCustomizer should be in the stickfigure package; hence, it can use the int and String constants representing mood states as defined in StickFigure.java.
Task 5
The next task is to augment the bean-info class, StickFigureBeanInfo. Add a getBeanDescriptor() method that returns a BeanDescriptor instance and associates StickFigureCustomizer.class with StickFigure.class.
Use HireBeanInfo as a model--only two or three lines of code required here.
Task 6
Compile all JavaTM source files, *.java, from workingdir by including the stickfigure directory in the path specification.
From a command window type (excluding the prompt):
C:\workingdir>javac stickfigure\*.java [DOS] or
/workingdir>javac stickfigure/*.java [UNIX]
An alternative approach, if you prefer graphical tools, is to build the stickfigure package within your Java development environment.
Verify that StickFigure.class, StickFigureEvent.class, and StickFigureListener.class exist within the stickfigure directory by typing (excluding the prompt):
C:\workingdir>dir stickfigure
10/15/98 09:28a <DIR> .
10/15/98 09:28a <DIR> ..
10/15/98 09:42a 1,196 MoodEditor.class
10/01/98 09:17p 1,233 MoodEditor.java
10/15/98 09:42a 7,082 StickFigure.class
09/25/98 05:57a 912 stickfigure.gif
10/14/98 02:39p 8,176 StickFigure.java
10/15/98 09:42a 1,812 StickFigureBeanInfo.class
10/01/98 09:23p 838 StickFigureBeanInfo.java
10/15/98 09:42a 3,795 StickFigureCustomizer.class
10/01/98 09:25p 4,091 StickFigureCustomizer.java
10/15/98 09:42a 956 StickFigureEvent.class
10/01/98 09:25p 831 StickFigureEvent.java
10/15/98 09:42a 298 StickFigureListener.class
10/01/98 09:27p 191 StickFigureListener.java
15 File(s) 31,411 bytes
Task 7
Build StickFigure.jar from workingdir by executing the file MakeStickFigureJar.bat (Windows) or MakeStickFigureJar.sh (UNIX).
From a command window type (excluding the prompt):
C:\workingdir>MakeStickFigureJar
jar cvmf stickfigure.txt StickFigure.jar
stickfigure\*.class stickfigure\*.gif
adding: stickfigure/MoodEditor.class (in=1196)
(out=716) (deflated 40%)
adding: stickfigure/StickFigure.class (in=7082)
(out=3195) (deflated 54%)
adding: stickfigure/StickFigureBeanInfo.class (in=1812)
(out=872) (deflated 51%)
adding: stickfigure/StickFigureCustomizer.class (in=3795)
(out=1903) (deflated 49%)
adding: stickfigure/StickFigureEvent.class (in=956)
(out=497) (deflated 48%)
adding: stickfigure/StickFigureListener.class (in=298)
(out=214) (deflated 28%)
adding: stickfigure/stickfigure.gif (in=912)
(out=567) (deflated 37%)
Task 8
Next, load the StickFigure Bean into the BeanBox (or a comparable tool) using "LoadJar..." from the BeanBox "File" menu.
Start up the BeanBox, select "LoadJar..." from the BeanBox "File" menu, and then navigate to your workingdir and open/load StickFigure.jar.
Task 9
Lastly, test the customizer dialog for StickFigure Bean. Activate the dialog by choosing "Customize..." from the BeanBox's "Edit" menu--the customizer dialog is modal (a blocking dialog). Other Bean-aware tools may, for example, provide a "Customize" command button in the property sheet, or elsewhere.
Verify that selecting different values from the toggle buttons changes the image so that it displays various combinations of body parts. Verify that the radio buttons correctly manipulate the mood, and that changes to mood from the customizer are immediately reflected in the property sheet.
Copyright © 1998-1999
MageLang Institute.
All Rights Reserved.