Graphics.drawPolygon

Graphics.drawPolygon

Class Overview | Class Members | This Package | All Packages

Syntax 1
public abstract void drawPolygon( int xPoints[], int yPoints[], int nPoints )
Parameters
xPoints
a an array of x coordinates.
yPoints
a an array of y coordinates.
nPoints
a the total number of points.
Description
Draws a closed polygon defined by arrays of x and y coordinates. Each pair of (xy) coordinates defines a point.

This method draws the polygon defined by nPoint line segments, where the first nPoint - 1 line segments are line segments from (xPoints[i - 1], yPoints[i - 1]) to (xPoints[i], yPoints[i]), for 1 ≤ i ≤ nPoints. The figure is automatically closed by drawing a line connecting the final point to the first point, if those points are different.

See Also
fillPolygon, drawPolyline



Syntax 2
public void drawPolygon( Polygon p )
Parameters
p
the polygon to draw.
Description
Draws the outline of a polygon defined by the specified Polygon object.

See Also
fillPolygon, drawPolyline