java.awt
Class Rectangle

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.awt.geom.RectangularShape sample code for java.awt.geom.RectangularShape definition code for java.awt.geom.RectangularShape 
      extended by java.awt.geom.Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D 
          extended by java.awt.Rectangle
All Implemented Interfaces:
Shape sample code for java.awt.Shape definition code for java.awt.Shape , Serializable sample code for java.io.Serializable definition code for java.io.Serializable , Cloneable sample code for java.lang.Cloneable definition code for java.lang.Cloneable
Direct Known Subclasses:
DefaultCaret sample code for javax.swing.text.DefaultCaret definition code for javax.swing.text.DefaultCaret

public class Rectangle
extends Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D
implements Shape sample code for java.awt.Shape definition code for java.awt.Shape , Serializable sample code for java.io.Serializable definition code for java.io.Serializable

A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-left point (xy) in the coordinate space, its width, and its height.

A Rectangle object's width and height are public fields. The constructors that create a Rectangle, and the methods that can modify one, do not prevent setting a negative value for width or height.

A Rectangle whose width or height is negative is considered empty. If the Rectangle is empty, then the isEmpty method returns true. No point can be contained by or inside an empty Rectangle. The values of width and height, however, 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 Rectangle objects has a negative width or height. These methods include intersects, intersection, and union.

Since:
JDK1.0
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.geom.Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D
Rectangle2D.Double sample code for java.awt.geom.Rectangle2D.Double definition code for java.awt.geom.Rectangle2D.Double , Rectangle2D.Float sample code for java.awt.geom.Rectangle2D.Float definition code for java.awt.geom.Rectangle2D.Float
 
Field Summary
 int height sample code for java.awt.Rectangle.height definition code for java.awt.Rectangle.height
          The height of the Rectangle.
 int width sample code for java.awt.Rectangle.width definition code for java.awt.Rectangle.width
          The width of the Rectangle.
 int x sample code for java.awt.Rectangle.x definition code for java.awt.Rectangle.x
          The x coordinate of the Rectangle.
 int y sample code for java.awt.Rectangle.y definition code for java.awt.Rectangle.y
          The y coordinate of the Rectangle.
 
Fields inherited from class java.awt.geom.Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D
OUT_BOTTOM sample code for java.awt.geom.Rectangle2D.OUT_BOTTOM definition code for java.awt.geom.Rectangle2D.OUT_BOTTOM , OUT_LEFT sample code for java.awt.geom.Rectangle2D.OUT_LEFT definition code for java.awt.geom.Rectangle2D.OUT_LEFT , OUT_RIGHT sample code for java.awt.geom.Rectangle2D.OUT_RIGHT definition code for java.awt.geom.Rectangle2D.OUT_RIGHT , OUT_TOP sample code for java.awt.geom.Rectangle2D.OUT_TOP definition code for java.awt.geom.Rectangle2D.OUT_TOP
 
Constructor Summary
Rectangle sample code for java.awt.Rectangle.Rectangle() definition code for java.awt.Rectangle.Rectangle() ()
          Constructs a new Rectangle whose top-left corner is at (0, 0) in the coordinate space, and whose width and height are both zero.
Rectangle sample code for java.awt.Rectangle.Rectangle(java.awt.Dimension) definition code for java.awt.Rectangle.Rectangle(java.awt.Dimension) (Dimension sample code for java.awt.Dimension definition code for java.awt.Dimension  d)
          Constructs a new Rectangle whose top left corner is (0, 0) and whose width and height are specified by the Dimension argument.
Rectangle sample code for java.awt.Rectangle.Rectangle(int, int) definition code for java.awt.Rectangle.Rectangle(int, int) (int width, int height)
          Constructs a new Rectangle whose top-left corner is at (0, 0) in the coordinate space, and whose width and height are specified by the arguments of the same name.
Rectangle sample code for java.awt.Rectangle.Rectangle(int, int, int, int) definition code for java.awt.Rectangle.Rectangle(int, int, int, int) (int x, int y, int width, int height)
          Constructs a new Rectangle whose top-left corner is specified as (xy) and whose width and height are specified by the arguments of the same name.
Rectangle sample code for java.awt.Rectangle.Rectangle(java.awt.Point) definition code for java.awt.Rectangle.Rectangle(java.awt.Point) (Point sample code for java.awt.Point definition code for java.awt.Point  p)
          Constructs a new Rectangle whose top-left corner is the specified Point, and whose width and height are both zero.
Rectangle sample code for java.awt.Rectangle.Rectangle(java.awt.Point, java.awt.Dimension) definition code for java.awt.Rectangle.Rectangle(java.awt.Point, java.awt.Dimension) (Point sample code for java.awt.Point definition code for java.awt.Point  p, Dimension sample code for java.awt.Dimension definition code for java.awt.Dimension  d)
          Constructs a new Rectangle whose top-left corner is specified by the Point sample code for java.awt.Point definition code for java.awt.Point argument, and whose width and height are specified by the Dimension sample code for java.awt.Dimension definition code for java.awt.Dimension argument.
Rectangle sample code for java.awt.Rectangle.Rectangle(java.awt.Rectangle) definition code for java.awt.Rectangle.Rectangle(java.awt.Rectangle) (Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle  r)
          Constructs a new Rectangle, initialized to match the values of the specified Rectangle.
 
Method Summary
 void add sample code for java.awt.Rectangle.add(int, int) definition code for java.awt.Rectangle.add(int, int) (int newx, int newy)
          Adds a point, specified by the integer arguments newx and newy, to this Rectangle.
 void add sample code for java.awt.Rectangle.add(java.awt.Point) definition code for java.awt.Rectangle.add(java.awt.Point) (Point sample code for java.awt.Point definition code for java.awt.Point  pt)
          Adds the specified Point to this Rectangle.
 void add sample code for java.awt.Rectangle.add(java.awt.Rectangle) definition code for java.awt.Rectangle.add(java.awt.Rectangle) (Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle  r)
          Adds a Rectangle to this Rectangle.
 boolean contains sample code for java.awt.Rectangle.contains(int, int) definition code for java.awt.Rectangle.contains(int, int) (int x, int y)
          Checks whether or not this Rectangle contains the point at the specified location (xy).
 boolean contains sample code for java.awt.Rectangle.contains(int, int, int, int) definition code for java.awt.Rectangle.contains(int, int, int, int) (int X, int Y, int W, int H)
          Checks whether this Rectangle entirely contains the Rectangle at the specified location (XY) with the specified dimensions (WH).
 boolean contains sample code for java.awt.Rectangle.contains(java.awt.Point) definition code for java.awt.Rectangle.contains(java.awt.Point) (Point sample code for java.awt.Point definition code for java.awt.Point  p)
          Checks whether or not this Rectangle contains the specified Point.
 boolean contains sample code for java.awt.Rectangle.contains(java.awt.Rectangle) definition code for java.awt.Rectangle.contains(java.awt.Rectangle) (Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle  r)
          Checks whether or not this Rectangle entirely contains the specified Rectangle.
 Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D createIntersection sample code for java.awt.Rectangle.createIntersection(java.awt.geom.Rectangle2D) definition code for java.awt.Rectangle.createIntersection(java.awt.geom.Rectangle2D) (Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D  r)
          Returns a new Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D object representing the intersection of this Rectangle with the specified Rectangle2D.
 Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D createUnion sample code for java.awt.Rectangle.createUnion(java.awt.geom.Rectangle2D) definition code for java.awt.Rectangle.createUnion(java.awt.geom.Rectangle2D) (Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D  r)
          Returns a new Rectangle2D object representing the union of this Rectangle with the specified Rectangle2D.
 boolean equals sample code for java.awt.Rectangle.equals(java.lang.Object) definition code for java.awt.Rectangle.equals(java.lang.Object) (Object sample code for java.lang.Object definition code for java.lang.Object  obj)
          Checks whether two rectangles are equal.
 Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle getBounds sample code for java.awt.Rectangle.getBounds() definition code for java.awt.Rectangle.getBounds() ()
          Gets the bounding Rectangle of this Rectangle.
 Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D getBounds2D sample code for java.awt.Rectangle.getBounds2D() definition code for java.awt.Rectangle.getBounds2D() ()
          Return the high precision bounding box of this rectangle.
 double getHeight sample code for java.awt.Rectangle.getHeight() definition code for java.awt.Rectangle.getHeight() ()
          Returns the height of the bounding Rectangle in double precision.
 Point sample code for java.awt.Point definition code for java.awt.Point getLocation sample code for java.awt.Rectangle.getLocation() definition code for java.awt.Rectangle.getLocation() ()
          Returns the location of this Rectangle.
 Dimension sample code for java.awt.Dimension definition code for java.awt.Dimension getSize sample code for java.awt.Rectangle.getSize() definition code for java.awt.Rectangle.getSize() ()
          Gets the size of this Rectangle, represented by the returned Dimension.
 double getWidth sample code for java.awt.Rectangle.getWidth() definition code for java.awt.Rectangle.getWidth() ()
          Returns the width of the bounding Rectangle in double precision.
 double getX sample code for java.awt.Rectangle.getX() definition code for java.awt.Rectangle.getX() ()
          Returns the X coordinate of the bounding Rectangle in double precision.
 double getY sample code for java.awt.Rectangle.getY() definition code for java.awt.Rectangle.getY() ()
          Returns the Y coordinate of the bounding Rectangle in double precision.
 void grow sample code for java.awt.Rectangle.grow(int, int) definition code for java.awt.Rectangle.grow(int, int) (int h, int v)
          Resizes the Rectangle both horizontally and vertically.
 boolean inside sample code for java.awt.Rectangle.inside(int, int) definition code for java.awt.Rectangle.inside(int, int) (int X, int Y)
          Deprecated. As of JDK version 1.1, replaced by contains(int, int).
 Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle intersection sample code for java.awt.Rectangle.intersection(java.awt.Rectangle) definition code for java.awt.Rectangle.intersection(java.awt.Rectangle) (Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle  r)
          Computes the intersection of this Rectangle with the specified Rectangle.
 boolean intersects sample code for java.awt.Rectangle.intersects(java.awt.Rectangle) definition code for java.awt.Rectangle.intersects(java.awt.Rectangle) (Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle  r)
          Determines whether or not this Rectangle and the specified Rectangle intersect.
 boolean isEmpty sample code for java.awt.Rectangle.isEmpty() definition code for java.awt.Rectangle.isEmpty() ()
          Determines whether or not this Rectangle is empty.
 void move sample code for java.awt.Rectangle.move(int, int) definition code for java.awt.Rectangle.move(int, int) (int x, int y)
          Deprecated. As of JDK version 1.1, replaced by setLocation(int, int).
 int outcode sample code for java.awt.Rectangle.outcode(double, double) definition code for java.awt.Rectangle.outcode(double, double) (double x, double y)
          Determines where the specified coordinates lie with respect to this Rectangle.
 void reshape sample code for java.awt.Rectangle.reshape(int, int, int, int) definition code for java.awt.Rectangle.reshape(int, int, int, int) (int x, int y, int width, int height)
          Deprecated. As of JDK version 1.1, replaced by setBounds(int, int, int, int).
 void resize sample code for java.awt.Rectangle.resize(int, int) definition code for java.awt.Rectangle.resize(int, int) (int width, int height)
          Deprecated. As of JDK version 1.1, replaced by setSize(int, int).
 void setBounds sample code for java.awt.Rectangle.setBounds(int, int, int, int) definition code for java.awt.Rectangle.setBounds(int, int, int, int) (int x, int y, int width, int height)
          Sets the bounding Rectangle of this Rectangle to the specified x, y, width, and height.
 void setBounds sample code for java.awt.Rectangle.setBounds(java.awt.Rectangle) definition code for java.awt.Rectangle.setBounds(java.awt.Rectangle) (Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle  r)
          Sets the bounding Rectangle of this Rectangle to match the specified Rectangle.
 void setLocation sample code for java.awt.Rectangle.setLocation(int, int) definition code for java.awt.Rectangle.setLocation(int, int) (int x, int y)
          Moves this Rectangle to the specified location.
 void setLocation sample code for java.awt.Rectangle.setLocation(java.awt.Point) definition code for java.awt.Rectangle.setLocation(java.awt.Point) (Point sample code for java.awt.Point definition code for java.awt.Point  p)
          Moves this Rectangle to the specified location.
 void setRect sample code for java.awt.Rectangle.setRect(double, double, double, double) definition code for java.awt.Rectangle.setRect(double, double, double, double) (double x, double y, double width, double height)
          Sets the bounds of this Rectangle to the specified x, y, width, and height.
 void setSize sample code for java.awt.Rectangle.setSize(java.awt.Dimension) definition code for java.awt.Rectangle.setSize(java.awt.Dimension) (Dimension sample code for java.awt.Dimension definition code for java.awt.Dimension  d)
          Sets the size of this Rectangle to match the specified Dimension.
 void setSize sample code for java.awt.Rectangle.setSize(int, int) definition code for java.awt.Rectangle.setSize(int, int) (int width, int height)
          Sets the size of this Rectangle to the specified width and height.
 String sample code for java.lang.String definition code for java.lang.String toString sample code for java.awt.Rectangle.toString() definition code for java.awt.Rectangle.toString() ()
          Returns a String representing this Rectangle and its values.
 void translate sample code for java.awt.Rectangle.translate(int, int) definition code for java.awt.Rectangle.translate(int, int) (int x, int y)
          Translates this Rectangle the indicated distance, to the right along the x coordinate axis, and downward along the y coordinate axis.
 Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle union sample code for java.awt.Rectangle.union(java.awt.Rectangle) definition code for java.awt.Rectangle.union(java.awt.Rectangle) (Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle  r)
          Computes the union of this Rectangle with the specified Rectangle.
 
Methods inherited from class java.awt.geom.Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D
add sample code for java.awt.geom.Rectangle2D.add(double, double) definition code for java.awt.geom.Rectangle2D.add(double, double) , add sample code for java.awt.geom.Rectangle2D.add(java.awt.geom.Point2D) definition code for java.awt.geom.Rectangle2D.add(java.awt.geom.Point2D) , add sample code for java.awt.geom.Rectangle2D.add(java.awt.geom.Rectangle2D) definition code for java.awt.geom.Rectangle2D.add(java.awt.geom.Rectangle2D) , contains sample code for java.awt.geom.Rectangle2D.contains(double, double) definition code for java.awt.geom.Rectangle2D.contains(double, double) , contains sample code for java.awt.geom.Rectangle2D.contains(double, double, double, double) definition code for java.awt.geom.Rectangle2D.contains(double, double, double, double) , getPathIterator sample code for java.awt.geom.Rectangle2D.getPathIterator(java.awt.geom.AffineTransform) definition code for java.awt.geom.Rectangle2D.getPathIterator(java.awt.geom.AffineTransform) , getPathIterator sample code for java.awt.geom.Rectangle2D.getPathIterator(java.awt.geom.AffineTransform, double) definition code for java.awt.geom.Rectangle2D.getPathIterator(java.awt.geom.AffineTransform, double) , hashCode sample code for java.awt.geom.Rectangle2D.hashCode() definition code for java.awt.geom.Rectangle2D.hashCode() , intersect sample code for java.awt.geom.Rectangle2D.intersect(java.awt.geom.Rectangle2D, java.awt.geom.Rectangle2D, java.awt.geom.Rectangle2D) definition code for java.awt.geom.Rectangle2D.intersect(java.awt.geom.Rectangle2D, java.awt.geom.Rectangle2D, java.awt.geom.Rectangle2D) , intersects sample code for java.awt.geom.Rectangle2D.intersects(double, double, double, double) definition code for java.awt.geom.Rectangle2D.intersects(double, double, double, double) , intersectsLine sample code for java.awt.geom.Rectangle2D.intersectsLine(double, double, double, double) definition code for java.awt.geom.Rectangle2D.intersectsLine(double, double, double, double) , intersectsLine sample code for java.awt.geom.Rectangle2D.intersectsLine(java.awt.geom.Line2D) definition code for java.awt.geom.Rectangle2D.intersectsLine(java.awt.geom.Line2D) , outcode sample code for java.awt.geom.Rectangle2D.outcode(java.awt.geom.Point2D) definition code for java.awt.geom.Rectangle2D.outcode(java.awt.geom.Point2D) , setFrame sample code for java.awt.geom.Rectangle2D.setFrame(double, double, double, double) definition code for java.awt.geom.Rectangle2D.setFrame(double, double, double, double) , setRect sample code for java.awt.geom.Rectangle2D.setRect(java.awt.geom.Rectangle2D) definition code for java.awt.geom.Rectangle2D.setRect(java.awt.geom.Rectangle2D) , union sample code for java.awt.geom.Rectangle2D.union(java.awt.geom.Rectangle2D, java.awt.geom.Rectangle2D, java.awt.geom.Rectangle2D) definition code for java.awt.geom.Rectangle2D.union(java.awt.geom.Rectangle2D, java.awt.geom.Rectangle2D, java.awt.geom.Rectangle2D)
 
Methods inherited from class java.awt.geom.RectangularShape sample code for java.awt.geom.RectangularShape definition code for java.awt.geom.RectangularShape
clone sample code for java.awt.geom.RectangularShape.clone() definition code for java.awt.geom.RectangularShape.clone() , contains sample code for java.awt.geom.RectangularShape.contains(java.awt.geom.Point2D) definition code for java.awt.geom.RectangularShape.contains(java.awt.geom.Point2D) , contains sample code for java.awt.geom.RectangularShape.contains(java.awt.geom.Rectangle2D) definition code for java.awt.geom.RectangularShape.contains(java.awt.geom.Rectangle2D) , getCenterX sample code for java.awt.geom.RectangularShape.getCenterX() definition code for java.awt.geom.RectangularShape.getCenterX() , getCenterY sample code for java.awt.geom.RectangularShape.getCenterY() definition code for java.awt.geom.RectangularShape.getCenterY() , getFrame sample code for java.awt.geom.RectangularShape.getFrame() definition code for java.awt.geom.RectangularShape.getFrame() , getMaxX sample code for java.awt.geom.RectangularShape.getMaxX() definition code for java.awt.geom.RectangularShape.getMaxX() , getMaxY sample code for java.awt.geom.RectangularShape.getMaxY() definition code for java.awt.geom.RectangularShape.getMaxY() , getMinX sample code for java.awt.geom.RectangularShape.getMinX() definition code for java.awt.geom.RectangularShape.getMinX() , getMinY sample code for java.awt.geom.RectangularShape.getMinY() definition code for java.awt.geom.RectangularShape.getMinY() , intersects sample code for java.awt.geom.RectangularShape.intersects(java.awt.geom.Rectangle2D) definition code for java.awt.geom.RectangularShape.intersects(java.awt.geom.Rectangle2D) , setFrame sample code for java.awt.geom.RectangularShape.setFrame(java.awt.geom.Point2D, java.awt.geom.Dimension2D) definition code for java.awt.geom.RectangularShape.setFrame(java.awt.geom.Point2D, java.awt.geom.Dimension2D) , setFrame sample code for java.awt.geom.RectangularShape.setFrame(java.awt.geom.Rectangle2D) definition code for java.awt.geom.RectangularShape.setFrame(java.awt.geom.Rectangle2D) , setFrameFromCenter sample code for java.awt.geom.RectangularShape.setFrameFromCenter(double, double, double, double) definition code for java.awt.geom.RectangularShape.setFrameFromCenter(double, double, double, double) , setFrameFromCenter sample code for java.awt.geom.RectangularShape.setFrameFromCenter(java.awt.geom.Point2D, java.awt.geom.Point2D) definition code for java.awt.geom.RectangularShape.setFrameFromCenter(java.awt.geom.Point2D, java.awt.geom.Point2D) , setFrameFromDiagonal sample code for java.awt.geom.RectangularShape.setFrameFromDiagonal(double, double, double, double) definition code for java.awt.geom.RectangularShape.setFrameFromDiagonal(double, double, double, double) , setFrameFromDiagonal sample code for java.awt.geom.RectangularShape.setFrameFromDiagonal(java.awt.geom.Point2D, java.awt.geom.Point2D) definition code for java.awt.geom.RectangularShape.setFrameFromDiagonal(java.awt.geom.Point2D, java.awt.geom.Point2D)
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 
Methods inherited from interface java.awt.Shape sample code for java.awt.Shape definition code for java.awt.Shape
contains sample code for java.awt.Shape.contains(double, double) definition code for java.awt.Shape.contains(double, double) , contains sample code for java.awt.Shape.contains(double, double, double, double) definition code for java.awt.Shape.contains(double, double, double, double) , contains sample code for java.awt.Shape.contains(java.awt.geom.Point2D) definition code for java.awt.Shape.contains(java.awt.geom.Point2D) , contains sample code for java.awt.Shape.contains(java.awt.geom.Rectangle2D) definition code for java.awt.Shape.contains(java.awt.geom.Rectangle2D) , getPathIterator sample code for java.awt.Shape.getPathIterator(java.awt.geom.AffineTransform) definition code for java.awt.Shape.getPathIterator(java.awt.geom.AffineTransform) , getPathIterator sample code for java.awt.Shape.getPathIterator(java.awt.geom.AffineTransform, double) definition code for java.awt.Shape.getPathIterator(java.awt.geom.AffineTransform, double) , intersects sample code for java.awt.Shape.intersects(double, double, double, double) definition code for java.awt.Shape.intersects(double, double, double, double) , intersects sample code for java.awt.Shape.intersects(java.awt.geom.Rectangle2D) definition code for java.awt.Shape.intersects(java.awt.geom.Rectangle2D)
 

Field Detail

x sample code for java.awt.Rectangle.x

public int x
The x coordinate of the Rectangle.

See Also:
setLocation(int, int) sample code for java.awt.Rectangle.setLocation(int, int) definition code for java.awt.Rectangle.setLocation(int, int) , getLocation() sample code for java.awt.Rectangle.getLocation() definition code for java.awt.Rectangle.getLocation()

y sample code for java.awt.Rectangle.y

public int y
The y coordinate of the Rectangle.

See Also:
setLocation(int, int) sample code for java.awt.Rectangle.setLocation(int, int) definition code for java.awt.Rectangle.setLocation(int, int) , getLocation() sample code for java.awt.Rectangle.getLocation() definition code for java.awt.Rectangle.getLocation()

width sample code for java.awt.Rectangle.width

public int width
The width of the Rectangle.

Since:
JDK1.0.
See Also:
setSize(int, int) sample code for java.awt.Rectangle.setSize(int, int) definition code for java.awt.Rectangle.setSize(int, int) , getSize() sample code for java.awt.Rectangle.getSize() definition code for java.awt.Rectangle.getSize()

height sample code for java.awt.Rectangle.height

public int height
The height of the Rectangle.

See Also:
setSize(int, int) sample code for java.awt.Rectangle.setSize(int, int) definition code for java.awt.Rectangle.setSize(int, int) , getSize() sample code for java.awt.Rectangle.getSize() definition code for java.awt.Rectangle.getSize()
Constructor Detail

Rectangle sample code for java.awt.Rectangle() definition code for java.awt.Rectangle()

public Rectangle()
Constructs a new Rectangle whose top-left corner is at (0, 0) in the coordinate space, and whose width and height are both zero.


Rectangle sample code for java.awt.Rectangle(java.awt.Rectangle) definition code for java.awt.Rectangle(java.awt.Rectangle)

public Rectangle(Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle  r)
Constructs a new Rectangle, initialized to match the values of the specified Rectangle.

Parameters:
r - the Rectangle from which to copy initial values to a newly constructed Rectangle
Since:
JDK1.1

Rectangle sample code for java.awt.Rectangle(int, int, int, int) definition code for java.awt.Rectangle(int, int, int, int)

public Rectangle(int x,
                 int y,
                 int width,
                 int height)
Constructs a new Rectangle whose top-left corner is specified as (xy) and whose width and height are specified by the arguments of the same name.

Parameters:
x - the specified x coordinate
y - the specified y coordinate
width - the width of the Rectangle
height - the height of the Rectangle

Rectangle sample code for java.awt.Rectangle(int, int) definition code for java.awt.Rectangle(int, int)

public Rectangle(int width,
                 int height)
Constructs a new Rectangle whose top-left corner is at (0, 0) in the coordinate space, and whose width and height are specified by the arguments of the same name.

Parameters:
width - the width of the Rectangle
height - the height of the Rectangle

Rectangle sample code for java.awt.Rectangle(java.awt.Point, java.awt.Dimension) definition code for java.awt.Rectangle(java.awt.Point, java.awt.Dimension)

public Rectangle(Point sample code for java.awt.Point definition code for java.awt.Point  p,
                 Dimension sample code for java.awt.Dimension definition code for java.awt.Dimension  d)
Constructs a new Rectangle whose top-left corner is specified by the Point sample code for java.awt.Point definition code for java.awt.Point argument, and whose width and height are specified by the Dimension sample code for java.awt.Dimension definition code for java.awt.Dimension argument.

Parameters:
p - a Point that is the top-left corner of the Rectangle
d - a Dimension, representing the width and height of the Rectangle

Rectangle sample code for java.awt.Rectangle(java.awt.Point) definition code for java.awt.Rectangle(java.awt.Point)

public Rectangle(Point sample code for java.awt.Point definition code for java.awt.Point  p)
Constructs a new Rectangle whose top-left corner is the specified Point, and whose width and height are both zero.

Parameters:
p - a Point that is the top left corner of the Rectangle

Rectangle sample code for java.awt.Rectangle(java.awt.Dimension) definition code for java.awt.Rectangle(java.awt.Dimension)

public Rectangle(Dimension sample code for java.awt.Dimension definition code for java.awt.Dimension  d)
Constructs a new Rectangle whose top left corner is (0, 0) and whose width and height are specified by the Dimension argument.

Parameters:
d - a Dimension, specifying width and height
Method Detail

getX sample code for java.awt.Rectangle.getX() definition code for java.awt.Rectangle.getX()

public double getX()
Returns the X coordinate of the bounding Rectangle in double precision.

Specified by:
getX sample code for java.awt.geom.RectangularShape.getX() definition code for java.awt.geom.RectangularShape.getX() in class RectangularShape sample code for java.awt.geom.RectangularShape definition code for java.awt.geom.RectangularShape
Returns:
the x coordinate of the bounding Rectangle.

getY sample code for java.awt.Rectangle.getY() definition code for java.awt.Rectangle.getY()

public double getY()
Returns the Y coordinate of the bounding Rectangle in double precision.

Specified by:
getY sample code for java.awt.geom.RectangularShape.getY() definition code for java.awt.geom.RectangularShape.getY() in class RectangularShape sample code for java.awt.geom.RectangularShape definition code for java.awt.geom.RectangularShape
Returns:
the y coordinate of the bounding Rectangle.

getWidth sample code for java.awt.Rectangle.getWidth() definition code for java.awt.Rectangle.getWidth()

public double getWidth()
Returns the width of the bounding Rectangle in double precision.

Specified by:
getWidth sample code for java.awt.geom.RectangularShape.getWidth() definition code for java.awt.geom.RectangularShape.getWidth() in class RectangularShape sample code for java.awt.geom.RectangularShape definition code for java.awt.geom.RectangularShape
Returns:
the width of the bounding Rectangle.

getHeight sample code for java.awt.Rectangle.getHeight() definition code for java.awt.Rectangle.getHeight()

public double getHeight()
Returns the height of the bounding Rectangle in double precision.

Specified by:
getHeight sample code for java.awt.geom.RectangularShape.getHeight() definition code for java.awt.geom.RectangularShape.getHeight() in class RectangularShape sample code for java.awt.geom.RectangularShape definition code for java.awt.geom.RectangularShape
Returns:
the height of the bounding Rectangle.

getBounds sample code for java.awt.Rectangle.getBounds() definition code for java.awt.Rectangle.getBounds()

public Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle  getBounds()
Gets the bounding Rectangle of this Rectangle.

This method is included for completeness, to parallel the getBounds method of Component sample code for java.awt.Component definition code for java.awt.Component .

Specified by:
getBounds sample code for java.awt.Shape.getBounds() definition code for java.awt.Shape.getBounds() in interface Shape sample code for java.awt.Shape definition code for java.awt.Shape
Overrides:
getBounds sample code for java.awt.geom.RectangularShape.getBounds() definition code for java.awt.geom.RectangularShape.getBounds() in class RectangularShape sample code for java.awt.geom.RectangularShape definition code for java.awt.geom.RectangularShape
Returns:
a new Rectangle, equal to the bounding Rectangle for this Rectangle.
Since:
JDK1.1
See Also:
Component.getBounds() sample code for java.awt.Component.getBounds() definition code for java.awt.Component.getBounds() , setBounds(Rectangle) sample code for java.awt.Rectangle.setBounds(java.awt.Rectangle) definition code for java.awt.Rectangle.setBounds(java.awt.Rectangle) , setBounds(int, int, int, int) sample code for java.awt.Rectangle.setBounds(int, int, int, int) definition code for java.awt.Rectangle.setBounds(int, int, int, int)

getBounds2D sample code for java.awt.Rectangle.getBounds2D() definition code for java.awt.Rectangle.getBounds2D()

public Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D  getBounds2D()
Return the high precision bounding box of this rectangle.

Specified by:
getBounds2D sample code for java.awt.Shape.getBounds2D() definition code for java.awt.Shape.getBounds2D() in interface Shape sample code for java.awt.Shape definition code for java.awt.Shape
Overrides:
getBounds2D sample code for java.awt.geom.Rectangle2D.getBounds2D() definition code for java.awt.geom.Rectangle2D.getBounds2D() in class Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D
Returns:
the bounding box of this Rectangle2D.
Since:
1.2
See Also:
Shape.getBounds() sample code for java.awt.Shape.getBounds() definition code for java.awt.Shape.getBounds()

setBounds sample code for java.awt.Rectangle.setBounds(java.awt.Rectangle) definition code for java.awt.Rectangle.setBounds(java.awt.Rectangle)

public void setBounds(Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle  r)
Sets the bounding Rectangle of this Rectangle to match the specified Rectangle.

This method is included for completeness, to parallel the setBounds method of Component.

Parameters:
r - the specified Rectangle
Since:
JDK1.1
See Also:
getBounds() sample code for java.awt.Rectangle.getBounds() definition code for java.awt.Rectangle.getBounds() , Component.setBounds(java.awt.Rectangle) sample code for java.awt.Component.setBounds(java.awt.Rectangle) definition code for java.awt.Component.setBounds(java.awt.Rectangle)

setBounds sample code for java.awt.Rectangle.setBounds(int, int, int, int) definition code for java.awt.Rectangle.setBounds(int, int, int, int)

public void setBounds(int x,
                      int y,
                      int width,
                      int height)
Sets the bounding Rectangle of this Rectangle to the specified x, y, width, and height.

This method is included for completeness, to parallel the setBounds method of Component.

Parameters:
x - the new x coordinate for the top-left corner of this Rectangle
y - the new y coordinate for the top-left corner of this Rectangle
width - the new width for this Rectangle
height - the new height for this Rectangle
Since:
JDK1.1
See Also:
getBounds() sample code for java.awt.Rectangle.getBounds() definition code for java.awt.Rectangle.getBounds() , Component.setBounds(int, int, int, int) sample code for java.awt.Component.setBounds(int, int, int, int) definition code for java.awt.Component.setBounds(int, int, int, int)

setRect sample code for java.awt.Rectangle.setRect(double, double, double, double) definition code for java.awt.Rectangle.setRect(double, double, double, double)

public void setRect(double x,
                    double y,
                    double width,
                    double height)
Sets the bounds of this Rectangle to the specified x, y, width, and height. This method is included for completeness, to parallel the setBounds method of Component.

Specified by:
setRect sample code for java.awt.geom.Rectangle2D.setRect(double, double, double, double) definition code for java.awt.geom.Rectangle2D.setRect(double, double, double, double) in class Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D
Parameters:
x - the x coordinate of the upper-left corner of the specified rectangle
y - the y coordinate of the upper-left corner of the specified rectangle
width - the new width for the Dimension object
height - the new height for the Dimension object

reshape sample code for java.awt.Rectangle.reshape(int, int, int, int) definition code for java.awt.Rectangle.reshape(int, int, int, int)

@Deprecated
public void reshape(int x,
                               int y,
                               int width,
                               int height)
Deprecated. As of JDK version 1.1, replaced by setBounds(int, int, int, int).

Sets the bounding Rectangle of this Rectangle to the specified x, y, width, and height.

Parameters:
x - the new x coordinate for the top-left corner of this Rectangle
y - the new y coordinate for the top-left corner of this Rectangle
width - the new width for this Rectangle
height - the new height for this Rectangle

getLocation sample code for java.awt.Rectangle.getLocation() definition code for java.awt.Rectangle.getLocation()

public Point sample code for java.awt.Point definition code for java.awt.Point  getLocation()
Returns the location of this Rectangle.

This method is included for completeness, to parallel the getLocation method of Component.

Returns:
the Point that is the top-left corner of this Rectangle.
Since:
JDK1.1
See Also:
Component.getLocation() sample code for java.awt.Component.getLocation() definition code for java.awt.Component.getLocation() , setLocation(Point) sample code for java.awt.Rectangle.setLocation(java.awt.Point) definition code for java.awt.Rectangle.setLocation(java.awt.Point) , setLocation(int, int) sample code for java.awt.Rectangle.setLocation(int, int) definition code for java.awt.Rectangle.setLocation(int, int)

setLocation sample code for java.awt.Rectangle.setLocation(java.awt.Point) definition code for java.awt.Rectangle.setLocation(java.awt.Point)

public void setLocation(Point sample code for java.awt.Point definition code for java.awt.Point  p)
Moves this Rectangle to the specified location.

This method is included for completeness, to parallel the setLocation method of Component.

Parameters:
p - the Point specifying the new location for this Rectangle
Since:
JDK1.1
See Also:
Component.setLocation(java.awt.Point) sample code for java.awt.Component.setLocation(java.awt.Point) definition code for java.awt.Component.setLocation(java.awt.Point) , getLocation() sample code for java.awt.Rectangle.getLocation() definition code for java.awt.Rectangle.getLocation()

setLocation sample code for java.awt.Rectangle.setLocation(int, int) definition code for java.awt.Rectangle.setLocation(int, int)

public void setLocation(int x,
                        int y)
Moves this Rectangle to the specified location.

This method is included for completeness, to parallel the setLocation method of Component.

Parameters:
x - the x coordinate of the new location
y - the y coordinate of the new location
Since:
JDK1.1
See Also:
getLocation() sample code for java.awt.Rectangle.getLocation() definition code for java.awt.Rectangle.getLocation() , Component.setLocation(int, int) sample code for java.awt.Component.setLocation(int, int) definition code for java.awt.Component.setLocation(int, int)

move sample code for java.awt.Rectangle.move(int, int) definition code for java.awt.Rectangle.move(int, int)

@Deprecated
public void move(int x,
                            int y)
Deprecated. As of JDK version 1.1, replaced by setLocation(int, int).

Moves this Rectangle to the specified location.

Parameters:
x - the x coordinate of the new location
y - the y coordinate of the new location

translate sample code for java.awt.Rectangle.translate(int, int) definition code for java.awt.Rectangle.translate(int, int)

public void translate(int x,
                      int y)
Translates this Rectangle the indicated distance, to the right along the x coordinate axis, and downward along the y coordinate axis.

Parameters:
x - the distance to move this Rectangle along the x axis
y - the distance to move this Rectangle along the y axis
See Also:
setLocation(int, int) sample code for java.awt.Rectangle.setLocation(int, int) definition code for java.awt.Rectangle.setLocation(int, int) , setLocation(java.awt.Point) sample code for java.awt.Rectangle.setLocation(java.awt.Point) definition code for java.awt.Rectangle.setLocation(java.awt.Point)

getSize sample code for java.awt.Rectangle.getSize() definition code for java.awt.Rectangle.getSize()

public Dimension sample code for java.awt.Dimension definition code for java.awt.Dimension  getSize()
Gets the size of this Rectangle, represented by the returned Dimension.

This method is included for completeness, to parallel the getSize method of Component.

Returns:
a Dimension, representing the size of this Rectangle.
Since:
JDK1.1
See Also:
Component.getSize() sample code for java.awt.Component.getSize() definition code for java.awt.Component.getSize() , setSize(Dimension) sample code for java.awt.Rectangle.setSize(java.awt.Dimension) definition code for java.awt.Rectangle.setSize(java.awt.Dimension) , setSize(int, int) sample code for java.awt.Rectangle.setSize(int, int) definition code for java.awt.Rectangle.setSize(int, int)

setSize sample code for java.awt.Rectangle.setSize(java.awt.Dimension) definition code for java.awt.Rectangle.setSize(java.awt.Dimension)

public void setSize(Dimension sample code for java.awt.Dimension definition code for java.awt.Dimension  d)
Sets the size of this Rectangle to match the specified Dimension.

This method is included for completeness, to parallel the setSize method of Component.

Parameters:
d - the new size for the Dimension object
Since:
JDK1.1
See Also:
Component.setSize(java.awt.Dimension) sample code for java.awt.Component.setSize(java.awt.Dimension) definition code for java.awt.Component.setSize(java.awt.Dimension) , getSize() sample code for java.awt.Rectangle.getSize() definition code for java.awt.Rectangle.getSize()

setSize sample code for java.awt.Rectangle.setSize(int, int) definition code for java.awt.Rectangle.setSize(int, int)

public void setSize(int width,
                    int height)
Sets the size of this Rectangle to the specified width and height.

This method is included for completeness, to parallel the setSize method of Component.

Parameters:
width - the new width for this Rectangle
height - the new height for this Rectangle
Since:
JDK1.1
See Also:
Component.setSize(int, int) sample code for java.awt.Component.setSize(int, int) definition code for java.awt.Component.setSize(int, int) , getSize() sample code for java.awt.Rectangle.getSize() definition code for java.awt.Rectangle.getSize()

resize sample code for java.awt.Rectangle.resize(int, int) definition code for java.awt.Rectangle.resize(int, int)

@Deprecated
public void resize(int width,
                              int height)
Deprecated. As of JDK version 1.1, replaced by setSize(int, int).

Sets the size of this Rectangle to the specified width and height.

Parameters:
width - the new width for this Rectangle
height - the new height for this Rectangle

contains sample code for java.awt.Rectangle.contains(java.awt.Point) definition code for java.awt.Rectangle.contains(java.awt.Point)

public boolean contains(Point sample code for java.awt.Point definition code for java.awt.Point  p)
Checks whether or not this Rectangle contains the specified Point.

Parameters:
p - the Point to test
Returns:
true if the Point (xy) is inside this Rectangle; false otherwise.
Since:
JDK1.1

contains sample code for java.awt.Rectangle.contains(int, int) definition code for java.awt.Rectangle.contains(int, int)

public boolean contains(int x,
                        int y)
Checks whether or not this Rectangle contains the point at the specified location (xy).

Parameters:
x - the specified x coordinate
y - the specified y coordinate
Returns:
true if the point (xy) is inside this Rectangle; false otherwise.
Since:
JDK1.1

contains sample code for java.awt.Rectangle.contains(java.awt.Rectangle) definition code for java.awt.Rectangle.contains(java.awt.Rectangle)

public boolean contains(Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle  r)
Checks whether or not this Rectangle entirely contains the specified Rectangle.

Parameters:
r - the specified Rectangle
Returns:
true if the Rectangle is contained entirely inside this Rectangle; false otherwise
Since:
JDK1.2

contains sample code for java.awt.Rectangle.contains(int, int, int, int) definition code for java.awt.Rectangle.contains(int, int, int, int)

public boolean contains(int X,
                        int Y,
                        int W,
                        int H)
Checks whether this Rectangle entirely contains the Rectangle at the specified location (XY) with the specified dimensions (WH).

Parameters:
X - the specified x coordinate
Y - the specified y coordinate
W - the width of the Rectangle
H - the height of the Rectangle
Returns:
true if the Rectangle specified by (XYWH) is entirely enclosed inside this Rectangle; false otherwise.
Since:
JDK1.1

inside sample code for java.awt.Rectangle.inside(int, int) definition code for java.awt.Rectangle.inside(int, int)

@Deprecated
public boolean inside(int X,
                                 int Y)
Deprecated. As of JDK version 1.1, replaced by contains(int, int).

Checks whether or not this Rectangle contains the point at the specified location (XY).

Parameters:
X - the specified x coordinate
Y - the specified y coordinate
Returns:
true if the point (XY) is inside this Rectangle; false otherwise.

intersects sample code for java.awt.Rectangle.intersects(java.awt.Rectangle) definition code for java.awt.Rectangle.intersects(java.awt.Rectangle)

public boolean intersects(Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle  r)
Determines whether or not this Rectangle and the specified Rectangle intersect. Two rectangles intersect if their intersection is nonempty.

Parameters:
r - the specified Rectangle
Returns:
true if the specified Rectangle and this Rectangle intersect; false otherwise.

intersection sample code for java.awt.Rectangle.intersection(java.awt.Rectangle) definition code for java.awt.Rectangle.intersection(java.awt.Rectangle)

public Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle  intersection(Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle  r)
Computes the intersection of this Rectangle with the specified Rectangle. Returns a new Rectangle that represents the intersection of the two rectangles. If the two rectangles do not intersect, the result will be an empty rectangle.

Parameters:
r - the specified Rectangle
Returns:
the largest Rectangle contained in both the specified Rectangle and in this Rectangle; or if the rectangles do not intersect, an empty rectangle.

union sample code for java.awt.Rectangle.union(java.awt.Rectangle) definition code for java.awt.Rectangle.union(java.awt.Rectangle)

public Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle  union(Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle  r)
Computes the union of this Rectangle with the specified Rectangle. Returns a new Rectangle that represents the union of the two rectangles

Parameters:
r - the specified Rectangle
Returns:
the smallest Rectangle containing both the specified Rectangle and this Rectangle.

add sample code for java.awt.Rectangle.add(int, int) definition code for java.awt.Rectangle.add(int, int)

public void add(int newx,
                int newy)
Adds a point, specified by the integer arguments newx and newy, to this Rectangle. The resulting Rectangle is the smallest Rectangle that contains both the original Rectangle and the specified point.

After adding a point, a call to contains with the added point as an argument does not necessarily return true. The contains method does not return true for points on the right or bottom edges of a Rectangle. Therefore, if the added point falls on the right or bottom edge of the enlarged Rectangle, contains returns false for that point.

Parameters:
newx - the x coordinate of the new point
newy - the y coordinate of the new point

add sample code for java.awt.Rectangle.add(java.awt.Point) definition code for java.awt.Rectangle.add(java.awt.Point)

public void add(Point sample code for java.awt.Point definition code for java.awt.Point  pt)
Adds the specified Point to this Rectangle. The resulting Rectangle is the smallest Rectangle that contains both the original Rectangle and the specified Point.

After adding a Point, a call to contains with the added Point as an argument does not necessarily return true. The contains method does not return true for points on the right or bottom edges of a Rectangle. Therefore if the added Point falls on the right or bottom edge of the enlarged Rectangle, contains returns false for that Point.

Parameters:
pt - the new Point to add to this Rectangle

add sample code for java.awt.Rectangle.add(java.awt.Rectangle) definition code for java.awt.Rectangle.add(java.awt.Rectangle)

public void add(Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle  r)
Adds a Rectangle to this Rectangle. The resulting Rectangle is the union of the two rectangles.

Parameters:
r - the specified Rectangle

grow sample code for java.awt.Rectangle.grow(int, int) definition code for java.awt.Rectangle.grow(int, int)

public void grow(int h,
                 int v)
Resizes the Rectangle both horizontally and vertically.

This method modifies the Rectangle so that it is h units larger on both the left and right side, and v units larger at both the top and bottom.

The new Rectangle has (x - h, y - v) as its top-left corner, a width of width + 2h, and a height of height + 2v.

If negative values are supplied for h and v, the size of the Rectangle decreases accordingly. The grow method does not check whether the resulting values of width and height are non-negative.

Parameters:
h - the horizontal expansion
v - the vertical expansion

isEmpty sample code for java.awt.Rectangle.isEmpty() definition code for java.awt.Rectangle.isEmpty()

public boolean isEmpty()
Determines whether or not this Rectangle is empty. A Rectangle is empty if its width or its height is less than or equal to zero.

Specified by:
isEmpty sample code for java.awt.geom.RectangularShape.isEmpty() definition code for java.awt.geom.RectangularShape.isEmpty() in class RectangularShape sample code for java.awt.geom.RectangularShape definition code for java.awt.geom.RectangularShape
Returns:
true if this Rectangle is empty; false otherwise.

outcode sample code for java.awt.Rectangle.outcode(double, double) definition code for java.awt.Rectangle.outcode(double, double)

public int outcode(double x,
                   double y)
Determines where the specified coordinates lie with respect to this Rectangle. This method computes a binary OR of the appropriate mask values indicating, for each side of this Rectangle, whether or not the specified coordinates are on the same side of the edge as the rest of this Rectangle.

Specified by:
outcode sample code for java.awt.geom.Rectangle2D.outcode(double, double) definition code for java.awt.geom.Rectangle2D.outcode(double, double) in class Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D
Parameters:
x - the specified x coordinate
y - the specified y coordinate
Returns:
the logical OR of all appropriate out codes.
Since:
1.2
See Also:
Rectangle2D.OUT_LEFT sample code for java.awt.geom.Rectangle2D.OUT_LEFT definition code for java.awt.geom.Rectangle2D.OUT_LEFT , Rectangle2D.OUT_TOP sample code for java.awt.geom.Rectangle2D.OUT_TOP definition code for java.awt.geom.Rectangle2D.OUT_TOP , Rectangle2D.OUT_RIGHT sample code for java.awt.geom.Rectangle2D.OUT_RIGHT definition code for java.awt.geom.Rectangle2D.OUT_RIGHT , Rectangle2D.OUT_BOTTOM sample code for java.awt.geom.Rectangle2D.OUT_BOTTOM definition code for java.awt.geom.Rectangle2D.OUT_BOTTOM

createIntersection sample code for java.awt.Rectangle.createIntersection(java.awt.geom.Rectangle2D) definition code for java.awt.Rectangle.createIntersection(java.awt.geom.Rectangle2D)

public Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D  createIntersection(Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D  r)
Returns a new Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D object representing the intersection of this Rectangle with the specified Rectangle2D.

Specified by:
createIntersection sample code for java.awt.geom.Rectangle2D.createIntersection(java.awt.geom.Rectangle2D) definition code for java.awt.geom.Rectangle2D.createIntersection(java.awt.geom.Rectangle2D) in class Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D
Parameters:
r - the Rectangle2D to be intersected with this Rectangle
Returns:
the largest Rectangle2D contained in both the specified Rectangle2D and in this Rectangle.
Since:
1.2

createUnion sample code for java.awt.Rectangle.createUnion(java.awt.geom.Rectangle2D) definition code for java.awt.Rectangle.createUnion(java.awt.geom.Rectangle2D)

public Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D  createUnion(Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D  r)
Returns a new Rectangle2D object representing the union of this Rectangle with the specified Rectangle2D.

Specified by:
createUnion sample code for java.awt.geom.Rectangle2D.createUnion(java.awt.geom.Rectangle2D) definition code for java.awt.geom.Rectangle2D.createUnion(java.awt.geom.Rectangle2D) in class Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D
Parameters:
r - the Rectangle2D to be combined with this Rectangle
Returns:
the smallest Rectangle2D containing both the specified Rectangle2D and this Rectangle.
Since:
1.2

equals sample code for java.awt.Rectangle.equals(java.lang.Object) definition code for java.awt.Rectangle.equals(java.lang.Object)

public boolean equals(Object sample code for java.lang.Object definition code for java.lang.Object  obj)
Checks whether two rectangles are equal.

The result is true if and only if the argument is not null and is a Rectangle object that has the same top-left corner, width, and height as this Rectangle.

Overrides:
equals sample code for java.awt.geom.Rectangle2D.equals(java.lang.Object) definition code for java.awt.geom.Rectangle2D.equals(java.lang.Object) in class Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D
Parameters:
obj - the Object to compare with this Rectangle
Returns:
true if the objects are equal; false otherwise.
See Also:
Object.hashCode() sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , Hashtable sample code for java.util.Hashtable definition code for java.util.Hashtable

toString sample code for java.awt.Rectangle.toString() definition code for java.awt.Rectangle.toString()

public String sample code for java.lang.String definition code for java.lang.String  toString()
Returns a String representing this Rectangle and its values.

Overrides:
toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() in class Object sample code for java.lang.Object definition code for java.lang.Object
Returns:
a String representing this Rectangle object's coordinate and size values.