java.awt.geom
Class Rectangle2D

java.lang.Object
  |
  +--java.awt.geom.RectangularShape
        |
        +--java.awt.geom.Rectangle2D
All Implemented Interfaces:
Cloneable, Shape
Direct Known Subclasses:
Rectangle, Rectangle2D.Double, Rectangle2D.Float
public abstract class Rectangle2D
extends RectangularShape

The Rectangle2D class describes a rectangle defined by a location (x, y) and dimension (w x h).

This class is only the abstract superclass for all objects that store a 2D rectangle. The actual storage representation of the coordinates is left to the subclass.

 

Nested Class Summary

static class Rectangle2D.Double
    The Double class defines a rectangle specified in double coordinates.
static class Rectangle2D.Float
    The Float class defines a rectangle specified in float coordinates.
 

 

Field Summary

static int OUT_BOTTOM
    The bitmask that indicates that a point lies below this Rectangle2D.
static int OUT_LEFT
    The bitmask that indicates that a point lies to the left of this Rectangle2D.
static int OUT_RIGHT
    The bitmask that indicates that a point lies to the right of this Rectangle2D.
static int OUT_TOP
    The bitmask that indicates that a point lies above this Rectangle2D.
 

 

Constructor Summary

protected Rectangle2D()
    This is an abstract class that cannot be instantiated directly.
 

 

Method Summary

 void add(double newx, double newy)
    Adds a point, specified by the double precision arguments newx and newy, to this Rectangle2D.
 void add(Point2D pt)
    Adds the Point2D object pt to this Rectangle2D.
 void add(Rectangle2D r)
    Adds a Rectangle2D object to this Rectangle2D.
 boolean contains(double x, double y)
    Tests if a specified coordinate is inside the boundary of this Rectangle2D.
 boolean contains(double x, double y, double w, double h)
    Tests if the interior of this Rectangle2D entirely contains the specified set of rectangular coordinates.
abstract  Rectangle2D createIntersection(Rectangle2D r)
    Returns a new Rectangle2D object representing the intersection of this Rectangle2D with the specified Rectangle2D.
abstract  Rectangle2D createUnion(Rectangle2D r)
    Returns a new Rectangle2D object representing the union of this Rectangle2D with the specified Rectangle2D.
 boolean equals(Object obj)
    Determines whether or not the specified Object is equal to this Rectangle2D.
 Rectangle2D getBounds2D()
    Returns the high precision bounding box of this Rectangle2D.
 PathIterator getPathIterator(AffineTransform at)
    Returns an iteration object that defines the boundary of this Rectangle2D.
 PathIterator getPathIterator(AffineTransform at, double flatness)
    Returns an iteration object that defines the boundary of the flattened Rectangle2D.
 int hashCode()
    Returns the hashcode for this Rectangle2D.
static void intersect(Rectangle2D src1, Rectangle2D src2, Rectangle2D dest)
    Intersects the pair of specified source Rectangle2D objects and puts the result into the specified destination Rectangle2D object.
 boolean intersects(double x, double y, double w, double h)
    Tests if the interior of this Rectangle2D intersects the interior of a specified set of rectangular coordinates.
 boolean intersectsLine(double x1, double y1, double x2, double y2)
    Tests if the specified line segment intersects the interior of this Rectangle2D.
 boolean intersectsLine(Line2D l)
    Tests if the specified line segment intersects the interior of this Rectangle2D.
abstract  int outcode(double x, double y)
    Determines where the specified coordinates lie with respect to this Rectangle2D.
 int outcode(Point2D p)
    Determines where the specified Point2D lies with respect to this Rectangle2D.
 void setFrame(double x, double y, double w, double h)
    Sets the location and size of the outer bounds of this Rectangle2D to the specified rectangular values.
abstract  void setRect(double x, double y, double w, double h)
    Sets the location and size of this Rectangle2D to the specified double values.
 void setRect(Rectangle2D r)
    Sets this Rectangle2D to be the same as the specified Rectangle2D.
static void union(Rectangle2D src1, Rectangle2D src2, Rectangle2D dest)
    Unions the pair of source Rectangle2D objects and puts the result into the specified destination Rectangle2D object.
 
Methods inherited from class java.awt.geom.RectangularShape
clone, contains, contains, getBounds, getCenterX