
 |
Chapter 19 java.awt Reference |
 |
Polygon
Name
Polygon
The Polygon class encapsulates
a collection of points used to create a series of line segments.
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.
- Description
-
Constructs an empty Polygon
object with no points.
- Parameters
-
- xPoints[]
-
The initial array of x coordinates for each point.
- yPoints[]
-
The initial array of y coordinates for each point.
- numPoints
-
The number of elements in both xPoints
and yPoints arrays to use.
- Throws
-
- ArrayIndexOutOfBoundsException
-
If
numPoints > xPoints.length
or numPoints > yPoints.length.
- Description
-
Constructs a Polygon object
with the set of points provided.
- Parameters
-
- x
-
The x coordinate of the
point to be added.
- y
-
The y coordinate of the
point to be added.
- Description
-
Adds the point (x, y)
to the end of the list of points for the Polygon.
- Parameters
-
- x
-
The x coordinate to test.
- y
-
The y coordinate to test.
- Returns
-
true if the Polygon
contains the point; false otherwise.
- Parameters
-
- p
-
The point to be tested.
- Returns
-
true if the Polygon
contains the point; false otherwise.
- Returns
-
Bounding Rectangle of the points within the Polygon.
- Description
-
Returns the smallest Rectangle
that contains all the points within the Polygon.
Replaced by getBounds().
- Implements
-
Shape.getBounds()
- Returns
-
Bounding Rectangle of the points within the Polygon.
- Description
-
Returns the smallest Rectangle
that contains all the points within the Polygon.
- Parameters
-
- x
-
The x coordinate of the point to be checked.
- y
-
The y coordinate of the point to be checked.
- Returns
-
true if (x,
y) within Polygon,
false otherwise.
- Description
-
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).
- Parameters
-
- deltaX
-
Amount to move horizontally.
- deltaY
-
Amount to move vertically.
- Description
-
Moves the Polygon to the location
(x+deltaX,
y+deltaY).
Graphics, Object,
Rectangle
|
|