15.7 Drawing Polygons and Polylines
Polygons are closed multisided shapes composed of straight-line segments. Polylines are sequences of connected points. Figure 15.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. 15.26. The application of Figs. 15.27–15.28 draws polygons and polylines.
Fig. 15.26 Graphics
methods for polygons and class Polygon
methods.
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 ... |
Get Java How to Program (early objects), 9/e 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.