Graphics Reference
In-Depth Information
Figure . . Classes for basic graphics
value, lineWidth for storing the width of the connected line segments by a dou-
ble value, and connectionGroups for recording the group of connected points
given by an ArrayList class.
Wehavesimilarclassesthatextend BasicPlotModel andarespecifictopartic-
ular statistical graphics: HistogramPlotModel and SingleBoxPlotModel .
See Fig. . .
Classes for Drawing Basic Graphics
17.3.5
Plotter is an interface for plotting and interactive operations. It declares methods
such as draw , drawFrame , drawRulers ,and plot .
Classes that implement the Plotter interface draw graphics of the correspond-
ing PlotModel in the Java graphics context. For example, ScatterPlotModel
accompanies ScatterPlotter ,and HistogramPlotModel accompanies
HistogramPlotter . hey realize methods for drawing particular graphics. he
objects of these classes are automatically created by createPlotter methods of
the corresponding PlotModel classes. his mechanism is an example of the “Fac-
tory method” design pattern.
Factory method defines an interface for creating an object, but let the sub-
classes decide which class to instance. Factory method lets a class defer in-
stantiation to subclasses (Gamma et al., ).
It is oten not clear what kind of components we will use at the firststage of program-
ming, although we have a general idea of the operations of certain components. We
want to implement the components later. We can achieve this functionality by using
interfaces for these components. As an interface has no function to create an object,
we use a method for creating an object called the factory method. his technique is
useful for creating two or more tightly connected objects.
Search WWH ::




Custom Search