<!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.Rectangle
</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.PrintJob.html#_top_">Previous</a>  <a href="java.awt.ScrollPane.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
<hr>
<h1>
  Class java.awt.Rectangle
</h1>
<pre>
<a href="java.lang.Object.html#_top_">java.lang.Object</a>
   |
   +----java.awt.Rectangle
</pre>
<hr>
<dl>
  <dt> public class <b>Rectangle</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>
A rectangle specifies an area in a coordinate space that is 
 defined by the rectangle's top-left point (<i>x</i>,&nbsp;<i>y</i>) 
 in the coordinate space, its width, and its height. 
 <p>
 A rectangle's <code>width</code> and <code>height</code> are 
 public fields. The constructors that allow you to create a 
 rectangle, and the methods that allow you to modify one, do not 
 prevent you from setting a negative value for width or height. 
 <p>
 A rectangle whose width or height is negative is considered 
 empty, and all methods defined by the <code>Rectangle</code> class  
 behave accordingly. If the rectangle is empty, then the method 
 <code>isEmpty</code> returns <code>true</code>. No point can be 
 contained by or inside an empty rectangle, however the values of 
 <code>width</code> and <code>height</code> are still valid. An 
 empty rectangle still has a location in the coordinate space, and 
 methods that change its size or location remain valid. The 
 behavior of methods that operate on more than one rectangle is 
 undefined if any of the participating rectangles has a negative 
 <code>width</code> or <code>height</code>. These methods include 
 <code>intersects</code>, <code>intersection</code>, and 
 <code>union</code>.
<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="#height"><b>height</b></a>
  <dd>  The height of the rectangle.
  <dt> <img src="images/magenta-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#width"><b>width</b></a>
  <dd>  The width of the rectangle.
  <dt> <img src="images/magenta-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#x"><b>x</b></a>
  <dd>  The <i>x</i> coordinate of the rectangle.
  <dt> <img src="images/magenta-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#y"><b>y</b></a>
  <dd>  The <i>y</i> coordinate of the rectangle.
</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="#Rectangle()"><b>Rectangle</b></a>()
  <dd>  Constructs a new rectangle whose top-left corner is at (0,&nbsp;0) 
 in the coordinate space, and whose width and height are zero.
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#Rectangle(java.awt.Dimension)"><b>Rectangle</b></a>(Dimension)
  <dd>  Constructs a new rectangle whose top left corner is  
 (0,&nbsp;0) and whose width and height are specified  
 by the <code>dimension</code> argument.
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#Rectangle(int, int)"><b>Rectangle</b></a>(int, int)
  <dd>  Constructs a new rectangle whose top-left corner is at (0,&nbsp;0) 
 in the coordinate space, and whose width and height are specified 
 by the arguments of the same name.
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#Rectangle(int, int, int, int)"><b>Rectangle</b></a>(int, int, int, int)
  <dd>  Constructs a new rectangle whose top-left corner is specified as
 (<code>x</code>,&nbsp;<code>y</code>) and whose width and height 
 are specified by the arguments of the same name.
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#Rectangle(java.awt.Point)"><b>Rectangle</b></a>(Point)
  <dd>  Constructs a new rectangle whose top-left corner is the  
 specified point, and whose width and height are zero.
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#Rectangle(java.awt.Point, java.awt.Dimension)"><b>Rectangle</b></a>(Point, Dimension)
  <dd>  Constructs a new rectangle whose top-left corner is specified 
 by the <code>point</code> argument, and whose width and height  
 are specified by the <code>dimension</code> argument.
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#Rectangle(java.awt.Rectangle)"><b>Rectangle</b></a>(Rectangle)
  <dd>  Constructs a new rectangle, initialized to match the values of
 the specificed rectangle.
</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="#add(int, int)"><b>add</b></a>(int, int)
  <dd>  Adds a point, specified by the integer arguments <code>newx</code>
 and <code>newy</code>, to this rectangle.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#add(java.awt.Point)"><b>add</b></a>(Point)
  <dd>  Adds the point <code>pt</code> to this rectangle.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#add(java.awt.Rectangle)"><b>add</b></a>(Rectangle)
  <dd>  Adds a rectangle to this rectangle.
  <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>  Checks whether this rectangle contains the point
 at the specified location (<i>x</i>,&nbsp;<i>y</i>).
  <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>  Checks whether this rectangle contains the specified point.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#equals(java.lang.Object)"><b>equals</b></a>(Object)
  <dd>  Checks whether two rectangles are equal.
  <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 rectangle of this rectangle.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getLocation()"><b>getLocation</b></a>()
  <dd>  Returns the location of this rectangle.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getSize()"><b>getSize</b></a>()
  <dd>  Gets the size (width and height) of this rectangle.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#grow(int, int)"><b>grow</b></a>(int, int)
  <dd>  Grows the rectangle both horizontally and vertically.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#hashCode()"><b>hashCode</b></a>()
  <dd>  Returns the hashcode for this rectangle.
  <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="#intersection(java.awt.Rectangle)"><b>intersection</b></a>(Rectangle)
  <dd>  Computes the intersection of this rectangle with the 
 specified rectangle.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#intersects(java.awt.Rectangle)"><b>intersects</b></a>(Rectangle)
  <dd>  Determines whether this rectangle and the specified rectangle  
 intersect.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#isEmpty()"><b>isEmpty</b></a>()
  <dd>  Determines whether this rectangle is empty.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#move(int, int)"><b>move</b></a>(int, int)
  <dd>  
<b>Deprecated.</b>
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#reshape(int, int, int, int)"><b>reshape</b></a>(int, int, int, int)
  <dd>  
<b>Deprecated.</b>
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#resize(int, int)"><b>resize</b></a>(int, int)
  <dd>  
<b>Deprecated.</b>
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#setBounds(int, int, int, int)"><b>setBounds</b></a>(int, int, int, int)
  <dd>  Sets the bounding rectangle of this rectangle to the specified 
 values for <code>x</code>, <code>y</code>, <code>width</code>, 
 and <code>height</code>.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#setBounds(java.awt.Rectangle)"><b>setBounds</b></a>(Rectangle)
  <dd>  Sets the bounding rectangle of this rectangle to match 
 the specified rectangle.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#setLocation(int, int)"><b>setLocation</b></a>(int, int)
  <dd>  Moves the rectangle to the specified location.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#setLocation(java.awt.Point)"><b>setLocation</b></a>(Point)
  <dd>  Moves the rectangle to the specified location.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#setSize(java.awt.Dimension)"><b>setSize</b></a>(Dimension)
  <dd>  Sets the size of this rectangle to match the specified dimension.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#setSize(int, int)"><b>setSize</b></a>(int, int)
  <dd>  Sets the size of this rectangle to the specified width and height.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#toString()"><b>toString</b></a>()
  <dd>  Returns a string representation of this rectangle 
 and its values.
  <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 rectangle the indicated distance,
 to the right along the <i>x</i> coordinate axis, and 
 downward along the <i>y</i> coordinate axis.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#union(java.awt.Rectangle)"><b>union</b></a>(Rectangle)
  <dd>  Computes the union of this rectangle with the 
 specified rectangle.
</dl>
<a name="variables"></a>
<h2>
  <img src="images/variables.gif" width=153 height=38 alt="Variables">
</h2>
<a name="x"><img src="images/magenta-ball.gif" width=12 height=12 alt=" o "></a>
<b>x</b>
<pre>
 public int x
</pre>
<dl>
  <dd> The <i>x</i> coordinate of the rectangle.<p>
</dl>
<a name="y"><img src="images/magenta-ball.gif" width=12 height=12 alt=" o "></a>
<b>y</b>
<pre>
 public int y
</pre>
<dl>
  <dd> The <i>y</i> coordinate of the rectangle.<p>
</dl>
<a name="width"><img src="images/magenta-ball.gif" width=12 height=12 alt=" o "></a>
<b>width</b>
<pre>
 public int width
</pre>
<dl>
  <dd> The width of the rectangle.<p>
</dl>
<a name="height"><img src="images/magenta-ball.gif" width=12 height=12 alt=" o "></a>
<b>height</b>
<pre>
 public int height
</pre>
<dl>
  <dd> The height of the rectangle.<p>
</dl>
<a name="constructors"></a>
<h2>
  <img src="images/constructors.gif" width=231 height=38 alt="Constructors">
</h2>
<a name="Rectangle"></a>
<a name="Rectangle()"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>Rectangle</b>
<pre>
 public Rectangle()
</pre>
<dl>
  <dd> Constructs a new rectangle whose top-left corner is at (0,&nbsp;0) 
 in the coordinate space, and whose width and height are zero.
<p>
</dl>
<a name="Rectangle(java.awt.Rectangle)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>Rectangle</b>
<pre>
 public Rectangle(<a href="#_top_">Rectangle</a> r)
</pre>
<dl>
  <dd> Constructs a new rectangle, initialized to match the values of
 the specificed rectangle.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> r - a rectangle from which to copy initial values.
  </dl></dd>
</dl>
<a name="Rectangle(int, int, int, int)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>Rectangle</b>
<pre>
 public Rectangle(int x,
                  int y,
                  int width,
                  int height)
</pre>
<dl>
  <dd> Constructs a new rectangle whose top-left corner is specified as
 (<code>x</code>,&nbsp;<code>y</code>) and whose width and height 
 are specified by the arguments of the same name.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> x - the <i>x</i> coordinate.
    <dd> y - the <i>y</i> coordinate.
    <dd> width - the width of the rectangle.
    <dd> height - the height of the rectangle.
  </dl></dd>
</dl>
<a name="Rectangle(int, int)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>Rectangle</b>
<pre>
 public Rectangle(int width,
                  int height)
</pre>
<dl>
  <dd> Constructs a new rectangle whose top-left corner is at (0,&nbsp;0) 
 in the coordinate space, and whose width and height are specified 
 by the arguments of the same name.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> width - the width of the rectangle.
    <dd> height - the height of the rectangle.
  </dl></dd>
</dl>
<a name="Rectangle(java.awt.Point, java.awt.Dimension)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>Rectangle</b>
<pre>
 public Rectangle(<a href="java.awt.Point.html#_top_">Point</a> p,
                  <a href="java.awt.Dimension.html#_top_">Dimension</a> d)
</pre>
<dl>
  <dd> Constructs a new rectangle whose top-left corner is specified 
 by the <code>point</code> argument, and whose width and height  
 are specified by the <code>dimension</code> argument.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> p - a point, the top-left corner of the rectangle.
    <dd> d - a dimension, representing the width and height.
  </dl></dd>
</dl>
<a name="Rectangle(java.awt.Point)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>Rectangle</b>
<pre>
 public Rectangle(<a href="java.awt.Point.html#_top_">Point</a> p)
</pre>
<dl>
  <dd> Constructs a new rectangle whose top-left corner is the  
 specified point, and whose width and height are zero.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> p - the top left corner of the rectangle.
  </dl></dd>
</dl>
<a name="Rectangle(java.awt.Dimension)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>Rectangle</b>
<pre>
 public Rectangle(<a href="java.awt.Dimension.html#_top_">Dimension</a> d)
</pre>
<dl>
  <dd> Constructs a new rectangle whose top left corner is  
 (0,&nbsp;0) and whose width and height are specified  
 by the <code>dimension</code> argument.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> d - a dimension, specifying width and height.
  </dl></dd>
</dl>
<a name="methods"></a>
<h2>
  <img src="images/methods.gif" width=151 height=38 alt="Methods">
</h2>
<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="#_top_">Rectangle</a> getBounds()
</pre>
<dl>
  <dd> Gets the bounding rectangle of this rectangle.
 <p>
 This method is included for completeness, to parallel the
 <code>getBounds</code> method of <code>Component</code>.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> a new rectangle, equal to the bounding rectangle
                for this rectangle.
    <dt> <b>See Also:</b>
    <dd> <a href="java.awt.Component.html#getBounds">getBounds</a>
  </dl></dd>
</dl>
<a name="setBounds(java.awt.Rectangle)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="setBounds"><b>setBounds</b></a>
<pre>
 public void setBounds(<a href="#_top_">Rectangle</a> r)
</pre>
<dl>
  <dd> Sets the bounding rectangle of this rectangle to match 
 the specified rectangle.
 <p>
 This method is included for completeness, to parallel the
 <code>setBounds</code> method of <code>Component</code>.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> r - a rectangle.
    <dt> <b>See Also:</b>
    <dd> <a href="java.awt.Component.html#setBounds(java.awt.Rectangle)">setBounds</a>
  </dl></dd>
</dl>
<a name="setBounds(int, int, int, int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="setBounds"><b>setBounds</b></a>
<pre>
 public void setBounds(int x,
                       int y,
                       int width,
                       int height)
</pre>
<dl>
  <dd> Sets the bounding rectangle of this rectangle to the specified 
 values for <code>x</code>, <code>y</code>, <code>width</code>, 
 and <code>height</code>.
 <p>
 This method is included for completeness, to parallel the
 <code>setBounds</code> method of <code>Component</code>.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> x - the new <i>x</i> coordinate for the top-left
                    corner of this rectangle.
    <dd> y - the new <i>y</i> coordinate for the top-left
                    corner of this rectangle.
    <dd> width - the new width for this rectangle.
    <dd> height - the new height for this rectangle.
    <dt> <b>See Also:</b>
    <dd> <a href="java.awt.Component.html#setBounds(int, int, int, int)">setBounds</a>
  </dl></dd>
</dl>
<a name="reshape(int, int, int, int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="reshape"><b>reshape</b></a>
<pre>
 public void reshape(int x,
                     int y,
                     int width,
                     int height)
</pre>
<dl>
<dd><b> Note: reshape() is deprecated.</b>
<i>As of JDK version 1.1,
 replaced by <code>setBounds(int, int, int, int)</code>.</i>
<p>
</dl>
<a name="getLocation()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getLocation"><b>getLocation</b></a>
<pre>
 public <a href="java.awt.Point.html#_top_">Point</a> getLocation()
</pre>
<dl>
  <dd> Returns the location of this rectangle.
 <p>
 This method is included for completeness, to parallel the
 <code>getLocation</code> method of <code>Component</code>.
<p>
  <dd><dl>
    <dt> <b>See Also:</b>
    <dd> <a href="java.awt.Component.html#getLocation">getLocation</a>
  </dl></dd>
</dl>
<a name="setLocation(java.awt.Point)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="setLocation"><b>setLocation</b></a>
<pre>
 public void setLocation(<a href="java.awt.Point.html#_top_">Point</a> p)
</pre>
<dl>
  <dd> Moves the rectangle to the specified location.
 <p>
 This method is included for completeness, to parallel the
 <code>setLocation</code> method of <code>Component</code>.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> p - the new location for the point.
    <dt> <b>See Also:</b>
    <dd> <a href="java.awt.Component.html#setLocation(java.awt.Point)">setLocation</a>
  </dl></dd>
</dl>
<a name="setLocation(int, int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="setLocation"><b>setLocation</b></a>
<pre>
 public void setLocation(int x,
                         int y)
</pre>
<dl>
  <dd> Moves the rectangle to the specified location.
 <p>
 This method is included for completeness, to parallel the
 <code>setLocation</code> method of <code>Component</code>.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> x - the <i>x</i> coordinate of the new location.
    <dd> y - the <i>y</i> coordinate of the new location.
    <dt> <b>See Also:</b>
    <dd> <a href="java.awt.Component.html#setLocation(int, int)">setLocation</a>
  </dl></dd>
</dl>
<a name="move(int, int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="move"><b>move</b></a>
<pre>
 public void move(int x,
                  int y)
</pre>
<dl>
<dd><b> Note: move() is deprecated.</b>
<i>As of JDK version 1.1,
 replaced by <code>setLocation(int, int)</code>.</i>
<p>
</dl>
<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 x,
                       int y)
</pre>
<dl>
  <dd> Translates the rectangle the indicated distance,
 to the right along the <i>x</i> coordinate axis, and 
 downward along the <i>y</i> coordinate axis.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> dx - the distance to move the rectangle
                 along the <i>x</i> axis.
    <dd> dy - the distance to move the rectangle
                 along the <i>y</i> axis.
    <dt> <b>See Also:</b>
    <dd> <a href="#setLocation(int, int)">setLocation</a>, <a href="#setLocation(java.awt.Point)">setLocation</a>
  </dl></dd>
</dl>
<a name="getSize()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getSize"><b>getSize</b></a>
<pre>
 public <a href="java.awt.Dimension.html#_top_">Dimension</a> getSize()
</pre>
<dl>
  <dd> Gets the size (width and height) of this rectangle.
 <p>
 This method is included for completeness, to parallel the
 <code>getSize</code> method of <code>Component</code>.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> a dimension, representing the size.
    <dt> <b>See Also:</b>
    <dd> <a href="java.awt.Component.html#getSize">getSize</a>
  </dl></dd>
</dl>
<a name="setSize(java.awt.Dimension)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="setSize"><b>setSize</b></a>
<pre>
 public void setSize(<a href="java.awt.Dimension.html#_top_">Dimension</a> d)
</pre>
<dl>
  <dd> Sets the size of this rectangle to match the specified dimension.
 <p>
 This method is included for completeness, to parallel the
 <code>setSize</code> method of <code>Component</code>.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> d - the new size for the Dimension object
    <dt> <b>See Also:</b>
    <dd> <a href="java.awt.Component.html#setSize(java.awt.Dimension)">setSize</a>
  </dl></dd>
</dl>
<a name="setSize(int, int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="setSize"><b>setSize</b></a>
<pre>
 public void setSize(int width,
                     int height)
</pre>
<dl>
  <dd> Sets the size of this rectangle to the specified width and height.
 <p>
 This method is included for completeness, to parallel the
 <code>setSize</code> method of <code>Component</code>.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> width - the new width for this rectangle object.
    <dd> height - the new height for this rectangle object.
    <dt> <b>See Also:</b>
    <dd> <a href="java.awt.Component.html#setSize(int, int)">setSize</a>
  </dl></dd>
</dl>
<a name="resize(int, int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="resize"><b>resize</b></a>
<pre>
 public void resize(int width,
                    int height)
</pre>
<dl>
<dd><b> Note: resize() is deprecated.</b>
<i>As of JDK version 1.1,
 replaced by <code>setSize(int, int)</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> Checks whether this rectangle contains the specified point.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> p - the point (location) to test.
    <dt> <b>Returns:</b>
    <dd> <code>true</code> if the point
            (<i>x</i>,&nbsp;<i>y</i>) is inside this rectangle; 
            <code>false</code> otherwise.
  </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> Checks whether this rectangle contains the point
 at the specified location (<i>x</i>,&nbsp;<i>y</i>).
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> x - the <i>x</i> coordinate.
    <dd> y - the <i>y</i> coordinate.
    <dt> <b>Returns:</b>
    <dd> <code>true</code> if the point
            (<i>x</i>,&nbsp;<i>y</i>) is inside this rectangle; 
            <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>
<a name="intersects(java.awt.Rectangle)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="intersects"><b>intersects</b></a>
<pre>
 public boolean intersects(<a href="#_top_">Rectangle</a> r)
</pre>
<dl>
  <dd> Determines whether this rectangle and the specified rectangle  
 intersect. Two rectangles intersect if their intersection is 
 nonempty.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> r - a rectangle.
    <dt> <b>Returns:</b>
    <dd> <code>true</code> if the specified rectangle
            and this rectangle insersect; 
            <code>false</code> otherwise.
  </dl></dd>
</dl>
<a name="intersection(java.awt.Rectangle)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="intersection"><b>intersection</b></a>
<pre>
 public <a href="#_top_">Rectangle</a> intersection(<a href="#_top_">Rectangle</a> r)
</pre>
<dl>
  <dd> Computes the intersection of this rectangle with the 
 specified rectangle. Returns a new rectangle that 
 represents the intersection of the two rectangles.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> r - a rectangle.
    <dt> <b>Returns:</b>
    <dd> the largest rectangle contained in both the
            specified rectangle and in this rectangle.
  </dl></dd>
</dl>
<a name="union(java.awt.Rectangle)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="union"><b>union</b></a>
<pre>
 public <a href="#_top_">Rectangle</a> union(<a href="#_top_">Rectangle</a> r)
</pre>
<dl>
  <dd> Computes the union of this rectangle with the 
 specified rectangle. Returns a new rectangle that 
 represents the union of the two rectangles.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> r - a rectangle.
    <dt> <b>Returns:</b>
    <dd> the smallest rectangle containing both the specified
            rectangle and this rectangle.
  </dl></dd>
</dl>
<a name="add(int, int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="add"><b>add</b></a>
<pre>
 public void add(int newx,
                 int newy)
</pre>
<dl>
  <dd> Adds a point, specified by the integer arguments <code>newx</code>
 and <code>newy</code>, to this rectangle. The resulting rectangle is
 the smallest rectangle that contains both the original rectangle 
 and the specified point.
 <p>
 After adding a point, a call to <code>contains<code> with the 
 added point as an argument will not necessarily return 
 <code>true</code>. The <code>contains</code> method does not 
 return <code>true</code> for points on the right or bottom 
 edges of a rectangle. Therefore if the added point falls on 
 the left or bottom edge of the enlarged rectangle, 
 <code>contains</code> will return <code>false</code> for that point.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> newx - the <i>x</i> coordinate of the new point.
    <dd> newy - the <i>y</i> coordinate of the new point.
  </dl></dd>
</dl>
<a name="add(java.awt.Point)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="add"><b>add</b></a>
<pre>
 public void add(<a href="java.awt.Point.html#_top_">Point</a> pt)
</pre>
<dl>
  <dd> Adds the point <code>pt</code> to this rectangle. The resulting 
 rectangle is the smallest rectangle that contains both the 
 original rectangle and the specified point.
 <p>
 After adding a point, a call to <code>contains<code> with the 
 added point as an argument will not necessarily return 
 <code>true</code>. The <code>contains</code> method does not 
 return <code>true</code> for points on the right or bottom 
 edges of a rectangle. Therefore if the added point falls on 
 the left or bottom edge of the enlarged rectangle, 
 <code>contains</code> will return <code>false</code> for that point.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> pt - the new point to add to the rectangle.
  </dl></dd>
</dl>
<a name="add(java.awt.Rectangle)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="add"><b>add</b></a>
<pre>
 public void add(<a href="#_top_">Rectangle</a> r)
</pre>
<dl>
  <dd> Adds a rectangle to this rectangle. The resulting rectangle is
 the union of the two rectangles.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> a - rectangle.
  </dl></dd>
</dl>
<a name="grow(int, int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="grow"><b>grow</b></a>
<pre>
 public void grow(int h,
                  int v)
</pre>
<dl>
  <dd> Grows the rectangle both horizontally and vertically.
 <p>
 This method modifies the rectangle so that it is 
 <code>h</code> units larger on both the left and right side, 
 and <code>v</code> units larger at both the top and bottom. 
 <p>
 The new rectangle has (<code>x&nbsp;-&nbsp;h</code>, 
 <code>y&nbsp;-&nbsp;v</code>) as its top-left corner, a 
 width of 
 <code>width</code>&nbsp;<code>+</code>&nbsp;<code>2h</code>, 
 and a height of 
 <code>height</code>&nbsp;<code>+</code>&nbsp;<code>2v</code>. 
 <p>
 If negative values are supplied for <code>h</code> and 
 <code>v</code>, the size of the rectangle decreases accordingly. 
 The <code>grow</code> method does not check whether the resulting 
 values of <code>width</code> and <code>height</code> are 
 non-negative.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> h - the horizontal expansion.
    <dd> v - the vertical expansion.
  </dl></dd>
</dl>
<a name="isEmpty()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="isEmpty"><b>isEmpty</b></a>
<pre>
 public boolean isEmpty()
</pre>
<dl>
  <dd> Determines whether this rectangle is empty. A rectangle is empty if 
 its width or its height is less than or equal to zero.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> <code>true</code> if this rectangle is empty;
             <code>false</code> otherwise.
  </dl></dd>
</dl>
<a name="hashCode()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="hashCode"><b>hashCode</b></a>
<pre>
 public int hashCode()
</pre>
<dl>
  <dd> Returns the hashcode for this rectangle.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the hashcode for this rectangle.
    <dt> <b>Overrides:</b>
    <dd> <a href="java.lang.Object.html#hashCode()">hashCode</a> in class <a href="java.lang.Object.html#_top_">Object</a>
  </dl></dd>
</dl>
<a name="equals(java.lang.Object)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="equals"><b>equals</b></a>
<pre>
 public boolean equals(<a href="java.lang.Object.html#_top_">Object</a> obj)
</pre>
<dl>
  <dd> Checks whether two rectangles are equal.
 <p>
 The result is <kbd>true</kbd> if and only if the argument is not 
 <kbd>null</kbd> and is a <kbd>Rectangle</kbd> object that has the 
 same top-left corner, width, and height as this rectangle.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> obj - the object to compare with.
    <dt> <b>Returns:</b>
    <dd> <code>true</code> if the objects are equal;
            <code>false</code> otherwise.
    <dt> <b>Overrides:</b>
    <dd> <a href="java.lang.Object.html#equals(java.lang.Object)">equals</a> in class <a href="java.lang.Object.html#_top_">Object</a>
  </dl></dd>
</dl>
<a name="toString()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="toString"><b>toString</b></a>
<pre>
 public <a href="java.lang.String.html#_top_">String</a> toString()
</pre>
<dl>
  <dd> Returns a string representation of this rectangle 
 and its values.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> a string representation of this rectangle.
    <dt> <b>Overrides:</b>
    <dd> <a href="java.lang.Object.html#toString()">toString</a> in class <a href="java.lang.Object.html#_top_">Object</a>
  </dl></dd>
</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.PrintJob.html#_top_">Previous</a>  <a href="java.awt.ScrollPane.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
</body>
</html>
