java.awt.Polygon (JDK 1.0)
This class defines a polygon as an array of points. The points of the polygon may be specified by the constructor, or with the addPoint() method. getBoundingBox() returns the smallest Rectangle that contains the polygon, and inside() tests whether a specified point is within the Polygon. Note that the arrays of X and Y points and the number of points in the polygon (not necessarily the same as the array size) are defined as public variables. Polygon objects are used when drawing polygons with the Graphics.drawPolygon() and Graphics.fillPolygon() methods.
public classPolygonextends Object implements Shape, Serializable { //Public ConstructorspublicPolygon(); publicPolygon(int[]xpoints, int[]ypoints, intnpoints); //Public Instance Variablespublic intnpoints; public int[]xpoints; public int[]ypoints; //Protected Instance Variables1.1 protected Rectanglebounds; //Public Instance Methodspublic voidaddPoint(intx, inty); 1.1 public booleancontains(Pointp); 1.1 public booleancontains(intx, inty); # public RectanglegetBoundingBox(); 1.1 public RectanglegetBounds(); //From Shape# public booleaninside(intx, inty); 1.1 public voidtranslate(intdeltaX, intdeltaY); }
Passed To:
Graphics.drawPolygon(), Graphics.fillPolygon()