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.
Method | Description |
---|---|
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. ... |
Get Java™ How to Program, Seventh 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.