java.awt

Class Polygon

  • java.lang.Object
    • java.awt.Polygon
  • All Implemented Interfaces:
    Shape, java.io.Serializable
    public class Polygon extends java.lang.Object implements Shape, java.io.Serializable
    The Polygon class encapsulates a description of a closed, two-dimensional region within a coordinate space. This region is bounded by an arbitrary number of line segments, each of which is one side of the polygon. Internally, a polygon comprises of a list of (x,y) coordinate pairs, where each pair defines a vertex of the polygon, and two successive pairs are the endpoints of a line that is a side of the polygon. The first and final pairs of (x,y) points are joined by a line segment that closes the polygon. This Polygon is defined with an even-odd winding rule. See WIND_EVEN_ODD for a definition of the even-odd winding rule. This class's hit-testing methods, which include the contains, intersects and inside methods, use the insideness definition described in the Shape class comments.
    Since:
    1.0
    See Also:
    Shape, Serialized Form
    • Fields 
      Modifier and Type Field and Description
      Ordinary member indicator npoints Reveal DetailHide Detail
      The total number of points.
      Ordinary member indicator xpoints Reveal DetailHide Detail
      The array of X coordinates.
      Ordinary member indicator ypoints Reveal DetailHide Detail
      The array of Y coordinates.
    • Constructors 
      Constructor and Description
      Ordinary member indicator Polygon Reveal DetailHide Detail
      Creates an empty polygon.
      Ordinary member indicator Polygon Reveal DetailHide Detail
      Constructs and initializes a Polygon from the specified parameters.
    • Methods 
      Modifier and Type Method and Description
      Ordinary member indicator addPoint Reveal DetailHide Detail
      Appends the specified coordinates to this Polygon.
      Ordinary member indicator contains Reveal DetailHide Detail
      Tests if the specified coordinates are inside the boundary of the Shape, as described by the definition of insideness.
      Ordinary member indicator contains Reveal DetailHide Detail
      Tests if the interior of the Shape entirely contains the specified rectangular area.
      Ordinary member indicator contains Reveal DetailHide Detail
      Determines whether the specified coordinates are inside this Polygon.
      Ordinary member indicator contains Reveal DetailHide Detail
      Determines whether the specified Point is inside this Polygon.
      Ordinary member indicator contains Reveal DetailHide Detail
      Tests if a specified Point2D is inside the boundary of the Shape, as described by the definition of insideness.
      Ordinary member indicator contains Reveal DetailHide Detail
      Tests if the interior of the Shape entirely contains the specified Rectangle2D.
      Ordinary member indicator getBoundingBox Reveal DetailHide Detail
      Deprecated. As of JDK version 1.1, replaced by getBounds().
      Ordinary member indicator getBounds Reveal DetailHide Detail
      Gets the bounding box of this Polygon.
      Ordinary member indicator getBounds2D Reveal DetailHide Detail
      Returns a high precision and more accurate bounding box of the Shape than the getBounds method.
      Ordinary member indicator getPathIterator Reveal DetailHide Detail
      Returns an iterator object that iterates along the boundary of this Polygon and provides access to the geometry of the outline of this Polygon.
      Ordinary member indicator getPathIterator Reveal DetailHide Detail
      Returns an iterator object that iterates along the boundary of the Shape and provides access to the geometry of the outline of the Shape.
      Ordinary member indicator inside Reveal DetailHide Detail
      Deprecated. As of JDK version 1.1, replaced by contains(int, int).
      Ordinary member indicator intersects Reveal DetailHide Detail
      Tests if the interior of the Shape intersects the interior of a specified rectangular area.
      Ordinary member indicator intersects Reveal DetailHide Detail
      Tests if the interior of the Shape intersects the interior of a specified Rectangle2D.
      Ordinary member indicator invalidate Reveal DetailHide Detail
      Invalidates or flushes any internally-cached data that depends on the vertex coordinates of this Polygon.
      Ordinary member indicator reset Reveal DetailHide Detail
      Resets this Polygon object to an empty polygon.
      Ordinary member indicator translate Reveal DetailHide Detail
      Translates the vertices of the Polygon by deltaX along the x axis and by deltaY along the y axis.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
This document was created by Dulcet from the OpenJDK sources. Copyright © 1993, 2012 Oracle and/or its affiliates. All rights reserved.

SourceForge