Java Reference
In-Depth Information
PaintBox Refinements
After some consideration, we might decide that the evolution of the PaintBox
project could be broken down into the following refinement steps:
Establish the basic user interface.
Allow the user to draw basic shapes using different stroke colors.
Allow the user to cut, copy, and paste shapes.
Allow the user to select, move, and fill shapes.
Allow the user to modify the dimensions of shapes.
Allow the user to save and reload drawings.
Include final touches such as the splash screen.
Note, first of all, that these refinements focus on breaking down the functional-
ity of the system. Additional refinements may be necessary as we get into the itera-
tive process. For instance, we may decide that we need a refinement to address
problems that were discovered in previous refinements.
The listed refinements could have been broken down further. For example, one
refinement could have been devoted to the ability to draw one particular type of
shape. The level of refinement, just like many other decisions when developing
a software system, is a judgment call. The developer must decide what is best in
any particular situation.
The order in which we tackle the refinements is also important. The user
interface refinement seems to be a logical first step because all other activity
relies on it. We may decide that the ability to save and reload a drawing would
be nice to have early for testing purposes. We might also note that being able
to select an object is fundamental to operations such as move and cut/copy/
paste. After further analysis, we end up with the set of refinements shown in
Figure J.2.
PaintBox Refinement #1
Most of the classes used for the interface come from predefined libraries. We
use Swing technology whenever reasonable. For example, we can use a JPanel
for the overall interface space, as well as separate JPanel objects to organize
the button tools and the drawing area. The JButton class will serve well for
the buttons. Classes such as JMenuBar and JMenuItem will serve to implement the
menus.
Figure J.3 shows a class diagram that represents the classes that are important
to the first refinement of the PaintBox project. Note that it does not include all
classes that might be needed, nor does it address anything other than the needs
Search WWH ::




Custom Search