The Polygon class encapsulates a collection of points used to create a series of line segments.
public class java.awt.Polygon extends java.lang.Object implements java.awt.Shape, java.io.Serializable { // Variables protected Rectangle bounds; public int npoints; public int xpoints[]; public int ypoints[]; // Constructors public Polygon(); public Polygon (int xpoints[], int ypoints, int npoints); // Instance Methods public void addPoint (int x, int y); public boolean contains (int x, int y); public boolean contains (Point p); public Rectangle getBoundingBox(); public Rectangle getBounds(); public boolean inside (int x,int y); public void translate (int deltaX, int deltaY); }
The rectangle that describes the boundaries of the Polygon.
The number of elements to use in the xpoints and ypoints arrays.
The array of x coordinates for each point.
The array of y coordinates for each point.
Constructs an empty Polygon object with no points.
The initial array of x coordinates for each point.
The initial array of y coordinates for each point.
The number of elements in both xPoints and yPoints arrays to use.
If numPoints > xPoints.length or numPoints > yPoints.length.
Constructs a Polygon object with the set of points provided.
The x coordinate of the point to be added.
The y coordinate of the point to be added.
Adds the point (x, y) to the end of the list of points for the Polygon.
The x coordinate to test.
The y coordinate to test.
true if the Polygon contains the point; false otherwise.
The point to be tested.
true if the Polygon contains the point; false otherwise.
Bounding Rectangle of the points within the Polygon.
Returns the smallest Rectangle that contains all the points within the Polygon. Replaced by getBounds().
Shape.getBounds()
Bounding Rectangle of the points within the Polygon.
Returns the smallest Rectangle that contains all the points within the Polygon.
The x coordinate of the point to be checked.
The y coordinate of the point to be checked.
true if (x, y) within Polygon, false otherwise.
Checks to see if the (x, y) point is within an area that would be filled if the Polygon was drawn with Graphics.fillPolygon(). Replaced by contains(int, int).
Amount to move horizontally.
Amount to move vertically.
Moves the Polygon to the location (x+deltaX, y+deltaY).
Graphics, Object, Rectangle
This HTML Help has been published using the chm2web software. |