The Java2D classes, as defined in the java.awt.geom package, define four
basic geometric constructions (plus the point, but that hardly counts).
The constructions are the line, the ellipse, the rectangle, and the
generalized path.

Perfect circles are a subset of the ellipse class; regular squares a
special kind of rectangle. The generalized path (defined in the
GeneralPath class) can define any series of joined line segments, or an
irregular closed space.

This exercise involves two classes. The first, LineDrawings, defines an
array of seven Shape objects. In the array, there are one square, one
circle, one triangle (defined as a GeneralPath), and four line segments
that together for a sort of star shape.

To read this article in full or to leave a comment, please click here