Shape class provides definitions of common properties for
objects that represent some form of geometric shape. These properties
Paintto be applied to the fillable interior of the shape (see
Paintto be applied to stroke the outline of the shape (see
An application should not extend the Shape class directly. Doing so may lead to an UnsupportedOperationException being thrown.
On the other hand, stroking those same shapes can often lead to fuzzy outlines because the default stroking attributes specify both that the default stroke width is 1.0 coordinates which often maps to exactly 1 device pixel and also that the stroke should straddle the border of the shape, falling half on either side of the border. Since the borders in many common shapes tend to fall directly on integer coordinates and those integer coordinates often map precisely to integer device locations, the borders tend to result in 50% coverage over the pixel rows and columns on either side of the border of the shape rather than 100% coverage on one or the other. Thus, fills may typically be crisp, but strokes are often fuzzy.
Two common solutions to avoid these fuzzy outlines are to use wider
strokes that cover more pixels completely - typically a stroke width of
2.0 will achieve this if there are no scale transforms in effect - or
to specify either the
stroke styles - which will bias the default single unit stroke onto one
of the full pixel rows or columns just inside or outside the border of