PolygonNamePolygon
DescriptionThe Polygon class encapsulates a collection of points used to create a series of line segments. Class Definition
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); } Variablesboundsprotected Rectangle boundsThe rectangle that describes the boundaries of the Polygon. npointspublic int npointsThe number of elements to use in the xpoints and ypoints arrays. xpointspublic int xpoints[]The array of x coordinates for each point. ypointspublic int ypoints[]The array of y coordinates for each point. ConstructorsPolygonpublic Polygon()
public Polygon (int xPoints[], int yPoints[], int numPoints)
Instance MethodsaddPointpublic void addPoint (int x, int y)
containspublic boolean contains (int x, int y)
public boolean contains (Point p)
getBoundingBoxpublic Rectangle getBoundingBox()
getBoundspublic Rectangle getBounds()
insidepublic boolean inside (int x,int y)
translatepublic void translate (int deltaX, int deltaY)
See AlsoGraphics, Object, Rectangle |
|