API Overview API Index Package Overview Direct link to this page
JDK 1.6
  java.awt. Polygon View Source
Author(s)
Sami Shaio
Herb Jellinek
Since
1.0
Version
1.26, 07/24/98
Serial
Hierarchy
 Object
      Polygon
Implements
 Shape
 Serializable
Subclasses
Description
public class Polygon
  The Polygon class encapsulates a description of a closed, two-dimensional region within a coordinate space.
See also:    Shape
Constructors
public Polygon ()
  Creates an empty polygon.
public Polygon (int[] xpoints, int[] ypoints, int npoints)
  Constructs and initializes a Polygon from the specified parameters.
Methods
Hide/Show inherited methods
public void addPoint (int x, int y)
  Appends the specified coordinates to this Polygon.
pack-private void calculateBounds (int[] xpoints, int[] ypoints, int npoints)
public boolean contains (double x, double y) [Specified in Shape]
  Tests if the specified coordinates are inside the boundary of the Shape.
public boolean contains (double x, double y, double w, double h) [Specified in Shape]
  Tests if the interior of the Shape entirely contains the specified rectangular area.
public boolean contains (int x, int y)
  Determines whether the specified coordinates are inside this Polygon.
public boolean contains (Point p)
  Determines whether the specified Point is inside this Polygon.
public boolean contains (Point2D p) [Specified in Shape]
  Tests if a specified Point2D is inside the boundary of the Shape.
public boolean contains (Rectangle2D r) [Specified in Shape]
  Tests if the interior of the Shape entirely contains the specified Rectangle2D.
@Deprecated
public Rectangle getBoundingBox ()
  Returns the bounds of this Polygon.
public Rectangle getBounds () [Specified in Shape]
  Gets the bounding box of this Polygon.
public Rectangle2D getBounds2D () [Specified in Shape]
  Returns a high precision and more accurate bounding box of the Shape than the getBounds method.
public PathIterator getPathIterator (AffineTransform at) [Specified in Shape]
  Returns an iterator object that iterates along the boundary of this Polygon and provides access to the geometry of the outline of this Polygon.
public PathIterator getPathIterator (AffineTransform at, double flatness) [Specified in Shape]
  Returns an iterator object that iterates along the boundary of the Shape and provides access to the geometry of the outline of the Shape.
@Deprecated
public boolean inside (int x, int y)
  Determines whether the specified coordinates are contained in this Polygon.
public boolean intersects (double x, double y, double w, double h) [Specified in Shape]
  Tests if the interior of the Shape intersects the interior of a specified rectangular area.
public boolean intersects (Rectangle2D r) [Specified in Shape]
  Tests if the interior of the Shape intersects the interior of a specified Rectangle2D.
public void invalidate ()
  Invalidates or flushes any internally-cached data that depends on the vertex coordinates of this Polygon.
public void reset ()
  Resets this Polygon object to an empty polygon.
public void translate (int deltaX, int deltaY)
  Translates the vertices of the Polygon by deltaX along the x axis and by deltaY along the y axis.
pack-private void updateBounds (int x, int y)
Fields
Hide/Show inherited fields
protected Rectangle bounds
  The bounds of this Polygon.
public int npoints
  The total number of points.
public int xpoints
  The array of X coordinates.
public int ypoints
  The array of Y coordinates.
Nested Classes
  Polygon.PolygonPathIterator
Generated By: JavaOnTracks Doclet 0.1.4     ©Thibaut Colar