13.7 Drawing Polygons and Polylines

Polygons are closed multisided shapes composed of straight-line segments. Polylines are sequences of connected points. Figure 13.26 discusses methods for drawing polygons and polylines. Some methods require a Polygon object (package java.awt). Class Polygon’s constructors are also described in Fig. 13.26. The application of Figs. 13.2713.28 draws polygons and polylines.

Image
Image

Fig. 13.26 | Graphics methods for polygons and class Polygon methods.

 1   // Fig. 13.27: PolygonsJPanel.java ...

Get Java™ How To Program (Early Objects), Tenth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.