12.7. Drawing Polygons and Polylines
Polygons are closed multisided shapes composed of straight-line segments. Polylines are sequences of connected points. Figure 12.26 discusses methods for drawing polygons and polylines. Note that some methods require a Polygon object (package java.awt). Class Polygon’s constructors are also described in Fig. 12.26. The application of Figs. 12.27–12.28 draws polygons and polylines.
|Graphics methods for drawing polygons|
|public void drawPolygon( int xPoints, int yPoints, int points )|
|Draws a polygon. The x-coordinate of each point is specified in the xPoints array, and the y-coordinate of each point in the yPoints array. ...|