<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<!--NewPage-->
<html>
<head>
<!-- Generated by javadoc on Wed Jul 28 01:21:15 GMT 1999 -->
<title>
  Class java.awt.Polygon
</title>
</head>
<body>
<a name="_top_"></a>
<pre>
<a href="packages.html">All Packages</a>  <a href="tree.html">Class Hierarchy</a>  <a href="Package-java.awt.html">This Package</a>  <a href="java.awt.Point.html#_top_">Previous</a>  <a href="java.awt.PopupMenu.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
<hr>
<h1>
  Class java.awt.Polygon
</h1>
<pre>
<a href="java.lang.Object.html#_top_">java.lang.Object</a>
   |
   +----java.awt.Polygon
</pre>
<hr>
<dl>
  <dt> public class <b>Polygon</b>
  <dt> extends <a href="java.lang.Object.html#_top_">Object</a>
  <dt> implements <a href="java.awt.Shape.html#_top_">Shape</a>, <a href="java.io.Serializable.html#_top_">Serializable</a>
</dl>
The <code>Polygon</code> 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 (<i>x</i>,&nbsp;<i>y</i>) coordinate pairs, 
 where each pair defines a <i>vertex</i> 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 (<i>x</i>,&nbsp;<i>y</i>) 
 points are joined by a line segment that closes the polygon.
<p>
<hr>
<a name="index"></a>
<h2>
  <img src="images/variable-index.gif" width=207 height=38 alt="Variable Index">
</h2>
<dl>
  <dt> <img src="images/magenta-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#bounds"><b>bounds</b></a>
  <dd> 
  <dt> <img src="images/magenta-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#npoints"><b>npoints</b></a>
  <dd>  The total number of points.
  <dt> <img src="images/magenta-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#xpoints"><b>xpoints</b></a>
  <dd>  The array of <i>x</i> coordinates.
  <dt> <img src="images/magenta-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#ypoints"><b>ypoints</b></a>
  <dd>  The array of <i>y</i> coordinates.
</dl>
<h2>
  <img src="images/constructor-index.gif" width=275 height=38 alt="Constructor Index">
</h2>
<dl>
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#Polygon()"><b>Polygon</b></a>()
  <dd>  Creates an empty polygon.
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#Polygon(int[], int[], int)"><b>Polygon</b></a>(int[], int[], int)
  <dd>  Constructs and initializes a polygon from the specified 
 parameters.
</dl>
<h2>
  <img src="images/method-index.gif" width=207 height=38 alt="Method Index">
</h2>
<dl>
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#addPoint(int, int)"><b>addPoint</b></a>(int, int)
  <dd>  Appends a point to this polygon.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#contains(int, int)"><b>contains</b></a>(int, int)
  <dd>  Determines whether the specified point is contained by this polygon.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#contains(java.awt.Point)"><b>contains</b></a>(Point)
  <dd>  Determines whether the specified point is inside the Polygon.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getBoundingBox()"><b>getBoundingBox</b></a>()
  <dd>  
<b>Deprecated.</b>
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getBounds()"><b>getBounds</b></a>()
  <dd>  Gets the bounding box of this polygon.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#inside(int, int)"><b>inside</b></a>(int, int)
  <dd>  
<b>Deprecated.</b>
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#translate(int, int)"><b>translate</b></a>(int, int)
  <dd>  Translates the vertices by <code>deltaX</code> along the 
 <i>x</i> axis and by <code>deltaY</code> along the 
 <i>y</i> axis.
</dl>
<a name="variables"></a>
<h2>
  <img src="images/variables.gif" width=153 height=38 alt="Variables">
</h2>
<a name="npoints"><img src="images/magenta-ball.gif" width=12 height=12 alt=" o "></a>
<b>npoints</b>
<pre>
 public int npoints
</pre>
<dl>
  <dd> The total number of points.<p>
</dl>
<a name="xpoints"><img src="images/magenta-ball.gif" width=12 height=12 alt=" o "></a>
<b>xpoints</b>
<pre>
 public int xpoints[]
</pre>
<dl>
  <dd> The array of <i>x</i> coordinates.<p>
</dl>
<a name="ypoints"><img src="images/magenta-ball.gif" width=12 height=12 alt=" o "></a>
<b>ypoints</b>
<pre>
 public int ypoints[]
</pre>
<dl>
  <dd> The array of <i>y</i> coordinates.<p>
</dl>
<a name="bounds"><img src="images/magenta-ball.gif" width=12 height=12 alt=" o "></a>
<b>bounds</b>
<pre>
 protected <a href="java.awt.Rectangle.html#_top_">Rectangle</a> bounds
</pre>
<a name="constructors"></a>
<h2>
  <img src="images/constructors.gif" width=231 height=38 alt="Constructors">
</h2>
<a name="Polygon"></a>
<a name="Polygon()"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>Polygon</b>
<pre>
 public Polygon()
</pre>
<dl>
  <dd> Creates an empty polygon.
<p>
</dl>
<a name="Polygon(int[], int[], int)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>Polygon</b>
<pre>
 public Polygon(int xpoints[],
                int ypoints[],
                int npoints)
</pre>
<dl>
  <dd> Constructs and initializes a polygon from the specified 
 parameters.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> xpoints - an array of <i>x</i> coordinates.
    <dd> ypoints - an array of <i>y</i> coordinates.
    <dd> npoints - the total number of points in the polygon.
    <dt> <b>Throws:</b> <a href="java.lang.NegativeArraySizeException.html#_top_">NegativeArraySizeException</a>
    <dd> if the value of
                       <code>npoints</code> is negative.
  </dl></dd>
</dl>
<a name="methods"></a>
<h2>
  <img src="images/methods.gif" width=151 height=38 alt="Methods">
</h2>
<a name="translate(int, int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="translate"><b>translate</b></a>
<pre>
 public void translate(int deltaX,
                       int deltaY)
</pre>
<dl>
  <dd> Translates the vertices by <code>deltaX</code> along the 
 <i>x</i> axis and by <code>deltaY</code> along the 
 <i>y</i> axis.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> deltaX - the amount to translate along the <i>x</i> axis
    <dd> deltaY - the amount to translate along the <i>y</i> axis
  </dl></dd>
</dl>
<a name="addPoint(int, int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="addPoint"><b>addPoint</b></a>
<pre>
 public void addPoint(int x,
                      int y)
</pre>
<dl>
  <dd> Appends a point to this polygon. 
 <p>
 If an operation that calculates the bounding box of this polygon
 has already been performed, such as <code>getBounds</code> 
 or <code>contains</code>, then this method updates the bounding box.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> x - the <i>x</i> coordinate of the point.
    <dd> y - the <i>y</i> coordinate of the point.
    <dt> <b>See Also:</b>
    <dd> <a href="#getBounds">getBounds</a>, <a href="#contains">contains</a>
  </dl></dd>
</dl>
<a name="getBounds()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getBounds"><b>getBounds</b></a>
<pre>
 public <a href="java.awt.Rectangle.html#_top_">Rectangle</a> getBounds()
</pre>
<dl>
  <dd> Gets the bounding box of this polygon. The bounding box is the
 smallest rectangle whose sides are parallel to the <i>x</i> and
 <i>y</i> axes of the coordinate space, and that can completely
 contain the polygon.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> a rectangle that defines the bounds of this polygon.
  </dl></dd>
</dl>
<a name="getBoundingBox()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getBoundingBox"><b>getBoundingBox</b></a>
<pre>
 public <a href="java.awt.Rectangle.html#_top_">Rectangle</a> getBoundingBox()
</pre>
<dl>
<dd><b> Note: getBoundingBox() is deprecated.</b>
<i>As of JDK version 1.1,
 replaced by <code>getBounds()</code>.</i>
<p>
</dl>
<a name="contains(java.awt.Point)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="contains"><b>contains</b></a>
<pre>
 public boolean contains(<a href="java.awt.Point.html#_top_">Point</a> p)
</pre>
<dl>
  <dd> Determines whether the specified point is inside the Polygon.
 Uses an even-odd insideness rule (also known as an alternating
 rule).
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> p - the point to be tested
  </dl></dd>
</dl>
<a name="contains(int, int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="contains"><b>contains</b></a>
<pre>
 public boolean contains(int x,
                         int y)
</pre>
<dl>
  <dd> Determines whether the specified point is contained by this polygon.   
 <p>
 (The <code>contains</code> method is based on code by 
 Hanpeter van Vliet [hvvliet@inter.nl.net].)
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> x - the <i>x</i> coordinate of the point to be tested.
    <dd> y - the <i>y</i> coordinate of the point to be tested.
    <dt> <b>Returns:</b>
    <dd> <code>true</code> if the point (<i>x</i>,&nbsp;<i>y</i>)
                       is contained by this polygon; 
                       <code>false</code> otherwise.
  </dl></dd>
</dl>
<a name="inside(int, int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="inside"><b>inside</b></a>
<pre>
 public boolean inside(int x,
                       int y)
</pre>
<dl>
<dd><b> Note: inside() is deprecated.</b>
<i>As of JDK version 1.1,
 replaced by <code>contains(int, int)</code>.</i>
<p>
</dl>
<hr>
<pre>
<a href="packages.html">All Packages</a>  <a href="tree.html">Class Hierarchy</a>  <a href="Package-java.awt.html">This Package</a>  <a href="java.awt.Point.html#_top_">Previous</a>  <a href="java.awt.PopupMenu.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
</body>
</html>
