java.awt.geom
Class Rectangle2D

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
All Implemented Interfaces:
Shape sample code for java.awt.Shape definition code for java.awt.Shape , Cloneable sample code for java.lang.Cloneable definition code for java.lang.Cloneable
Direct Known Subclasses:
Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle , 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

public abstract class Rectangle2D
extends RectangularShape sample code for java.awt.geom.RectangularShape definition code for java.awt.geom.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 sample code for java.awt.geom.Rectangle2D.Double definition code for java.awt.geom.Rectangle2D.Double
          The Double class defines a rectangle specified in double coordinates.
static class Rectangle2D.Float sample code for java.awt.geom.Rectangle2D.Float definition code for java.awt.geom.Rectangle2D.Float
          The Float class defines a rectangle specified in float coordinates.
 
Field Summary
static int OUT_BOTTOM sample code for java.awt.geom.Rectangle2D.OUT_BOTTOM definition code for java.awt.geom.Rectangle2D.OUT_BOTTOM
          The bitmask that indicates that a point lies below this Rectangle2D.
static int OUT_LEFT sample code for java.awt.geom.Rectangle2D.OUT_LEFT definition code for java.awt.geom.Rectangle2D.OUT_LEFT
          The bitmask that indicates that a point lies to the left of this Rectangle2D.
static int OUT_RIGHT sample code for java.awt.geom.Rectangle2D.OUT_RIGHT definition code for java.awt.geom.Rectangle2D.OUT_RIGHT
          The bitmask that indicates that a point lies to the right of this Rectangle2D.
static int OUT_TOP sample code for java.awt.geom.Rectangle2D.OUT_TOP definition code for java.awt.geom.Rectangle2D.OUT_TOP
          The bitmask that indicates that a point lies above this Rectangle2D.
 
Constructor Summary
protected Rectangle2D sample code for java.awt.geom.Rectangle2D.Rectangle2D() definition code for java.awt.geom.Rectangle2D.Rectangle2D() ()
          This is an abstract class that cannot be instantiated directly.
 
Method Summary
 void add sample code for java.awt.geom.Rectangle2D.add(double, double) definition code for java.awt.geom.Rectangle2D.add(double, double) (double newx, double newy)
          Adds a point, specified by the double precision arguments newx and newy, to this Rectangle2D.
 void 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) (Point2D sample code for java.awt.geom.Point2D definition code for java.awt.geom.Point2D  pt)
          Adds the Point2D object pt to this Rectangle2D.
 void 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) (Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D  r)
          Adds a Rectangle2D object to this Rectangle2D.
 boolean contains sample code for java.awt.geom.Rectangle2D.contains(double, double) definition code for java.awt.geom.Rectangle2D.contains(double, double) (double x, double y)
          Tests if a specified coordinate is inside the boundary of this Rectangle2D.
 boolean 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) (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 sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D 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) (Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D  r)
          Returns a new Rectangle2D object representing the intersection of this Rectangle2D with the specified Rectangle2D.
abstract  Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D 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) (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 Rectangle2D with the specified Rectangle2D.
 boolean equals sample code for java.awt.geom.Rectangle2D.equals(java.lang.Object) definition code for java.awt.geom.Rectangle2D.equals(java.lang.Object) (Object sample code for java.lang.Object definition code for java.lang.Object  obj)
          Determines whether or not the specified Object is equal to this Rectangle2D.
 Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D getBounds2D sample code for java.awt.geom.Rectangle2D.getBounds2D() definition code for java.awt.geom.Rectangle2D.getBounds2D() ()
          Returns the high precision bounding box of this Rectangle2D.
 PathIterator sample code for java.awt.geom.PathIterator definition code for java.awt.geom.PathIterator 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) (AffineTransform sample code for java.awt.geom.AffineTransform definition code for java.awt.geom.AffineTransform  at)
          Returns an iteration object that defines the boundary of this Rectangle2D.
 PathIterator sample code for java.awt.geom.PathIterator definition code for java.awt.geom.PathIterator 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) (AffineTransform sample code for java.awt.geom.AffineTransform definition code for java.awt.geom.AffineTransform  at, double flatness)
          Returns an iteration object that defines the boundary of the flattened Rectangle2D.
 int hashCode sample code for java.awt.geom.Rectangle2D.hashCode() definition code for java.awt.geom.Rectangle2D.hashCode() ()
          Returns the hashcode for this Rectangle2D.
static void 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) (Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D  src1, Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D  src2, Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D  dest)
          Intersects the pair of specified source Rectangle2D objects and puts the result into the specified destination Rectangle2D object.
 boolean 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) (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 sample code for java.awt.geom.Rectangle2D.intersectsLine(double, double, double, double) definition code for java.awt.geom.Rectangle2D.intersectsLine(double, double, double, double) (double x1, double y1, double x2, double y2)
          Tests if the specified line segment intersects the interior of this Rectangle2D.
 boolean 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) (Line2D sample code for java.awt.geom.Line2D definition code for java.awt.geom.Line2D  l)
          Tests if the specified line segment intersects the interior of this Rectangle2D.
abstract  int outcode sample code for java.awt.geom.Rectangle2D.outcode(double, double) definition code for java.awt.geom.Rectangle2D.outcode(double, double) (double x, double y)
          Determines where the specified coordinates lie with respect to this Rectangle2D.
 int 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) (Point2D sample code for java.awt.geom.Point2D definition code for java.awt.geom.Point2D  p)
          Determines where the specified Point2D sample code for java.awt.geom.Point2D definition code for java.awt.geom.Point2D lies with respect to this Rectangle2D.
 void 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) (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 sample code for java.awt.geom.Rectangle2D.setRect(double, double, double, double) definition code for java.awt.geom.Rectangle2D.setRect(double, double, double, double) (double x, double y, double w, double h)
          Sets the location and size of this Rectangle2D to the specified double values.
 void 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) (Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D  r)
          Sets this Rectangle2D to be the same as the specified Rectangle2D.
static void 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) (Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D  src1, Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D  src2, Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.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 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) , getBounds sample code for java.awt.geom.RectangularShape.getBounds() definition code for java.awt.geom.RectangularShape.getBounds() , 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() , getHeight sample code for java.awt.geom.RectangularShape.getHeight() definition code for java.awt.geom.RectangularShape.getHeight() , 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() , getWidth sample code for java.awt.geom.RectangularShape.getWidth() definition code for java.awt.geom.RectangularShape.getWidth() , getX sample code for java.awt.geom.RectangularShape.getX() definition code for java.awt.geom.RectangularShape.getX() , getY sample code for java.awt.geom.RectangularShape.getY() definition code for java.awt.geom.RectangularShape.getY() , 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) , isEmpty sample code for java.awt.geom.RectangularShape.isEmpty() definition code for java.awt.geom.RectangularShape.isEmpty() , 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() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , 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)
 

Field Detail

OUT_LEFT sample code for java.awt.geom.Rectangle2D.OUT_LEFT

public static final int OUT_LEFT
The bitmask that indicates that a point lies to the left of this Rectangle2D.

Since:
1.2
See Also:
Constant Field Values

OUT_TOP sample code for java.awt.geom.Rectangle2D.OUT_TOP

public static final int OUT_TOP
The bitmask that indicates that a point lies above this Rectangle2D.

Since:
1.2
See Also:
Constant Field Values

OUT_RIGHT sample code for java.awt.geom.Rectangle2D.OUT_RIGHT

public static final int OUT_RIGHT
The bitmask that indicates that a point lies to the right of this Rectangle2D.

Since:
1.2
See Also:
Constant Field Values

OUT_BOTTOM sample code for java.awt.geom.Rectangle2D.OUT_BOTTOM

public static final int OUT_BOTTOM
The bitmask that indicates that a point lies below this Rectangle2D.

Since:
1.2
See Also:
Constant Field Values
Constructor Detail

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

protected Rectangle2D()
This is an abstract class that cannot be instantiated directly. Type-specific implementation subclasses are available for instantiation and provide a number of formats for storing the information necessary to satisfy the various accessor methods below.

See Also:
Rectangle2D.Float sample code for java.awt.geom.Rectangle2D.Float definition code for java.awt.geom.Rectangle2D.Float , Rectangle2D.Double sample code for java.awt.geom.Rectangle2D.Double definition code for java.awt.geom.Rectangle2D.Double , Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle
Method Detail

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)

public abstract void setRect(double x,
                             double y,
                             double w,
                             double h)
Sets the location and size of this Rectangle2D to the specified double values.

Parameters:
x, y - the coordinates to which to set the location of the upper left corner of this Rectangle2D
w - the value to use to set the width of this Rectangle2D
h - the value to use to set the height of this Rectangle2D
Since:
1.2

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)

public void setRect(Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D  r)
Sets this Rectangle2D to be the same as the specified Rectangle2D.

Parameters:
r - the specified Rectangle2D
Since:
1.2

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)

public boolean intersectsLine(double x1,
                              double y1,
                              double x2,
                              double y2)
Tests if the specified line segment intersects the interior of this Rectangle2D.

Parameters:
x1, y1 - the first endpoint of the specified line segment
x2, y2 - the second endpoint of the specified line segment
Returns:
true if the specified line segment intersects the interior of this Rectangle2D; false otherwise.
Since:
1.2

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)

public boolean intersectsLine(Line2D sample code for java.awt.geom.Line2D definition code for java.awt.geom.Line2D  l)
Tests if the specified line segment intersects the interior of this Rectangle2D.

Parameters:
l - the specified Line2D sample code for java.awt.geom.Line2D definition code for java.awt.geom.Line2D to test for intersection with the interior of this Rectangle2D
Returns:
true if the specified Line2D intersects the interior of this Rectangle2D; false otherwise.
Since:
1.2

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

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

Parameters:
x, y - the specified coordinates
Returns:
the logical OR of all appropriate out codes.
Since:
1.2
See Also:
OUT_LEFT sample code for java.awt.geom.Rectangle2D.OUT_LEFT definition code for java.awt.geom.Rectangle2D.OUT_LEFT , OUT_TOP sample code for java.awt.geom.Rectangle2D.OUT_TOP definition code for java.awt.geom.Rectangle2D.OUT_TOP , OUT_RIGHT sample code for java.awt.geom.Rectangle2D.OUT_RIGHT definition code for java.awt.geom.Rectangle2D.OUT_RIGHT , OUT_BOTTOM sample code for java.awt.geom.Rectangle2D.OUT_BOTTOM definition code for java.awt.geom.Rectangle2D.OUT_BOTTOM

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)

public int outcode(Point2D sample code for java.awt.geom.Point2D definition code for java.awt.geom.Point2D  p)
Determines where the specified Point2D sample code for java.awt.geom.Point2D definition code for java.awt.geom.Point2D lies with respect to this Rectangle2D. This method computes a binary OR of the appropriate mask values indicating, for each side of this Rectangle2D, whether or not the specified Point2D is on the same side of the edge as the rest of this Rectangle2D.

Parameters:
p - the specified Point2D
Returns:
the logical OR of all appropriate out codes.
Since:
1.2
See Also:
OUT_LEFT sample code for java.awt.geom.Rectangle2D.OUT_LEFT definition code for java.awt.geom.Rectangle2D.OUT_LEFT , OUT_TOP sample code for java.awt.geom.Rectangle2D.OUT_TOP definition code for java.awt.geom.Rectangle2D.OUT_TOP , OUT_RIGHT sample code for java.awt.geom.Rectangle2D.OUT_RIGHT definition code for java.awt.geom.Rectangle2D.OUT_RIGHT , OUT_BOTTOM sample code for java.awt.geom.Rectangle2D.OUT_BOTTOM definition code for java.awt.geom.Rectangle2D.OUT_BOTTOM

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)

public 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.

Specified by:
setFrame sample code for java.awt.geom.RectangularShape.setFrame(double, double, double, double) definition code for java.awt.geom.RectangularShape.setFrame(double, double, double, double) in class RectangularShape sample code for java.awt.geom.RectangularShape definition code for java.awt.geom.RectangularShape
Parameters:
x, y - the coordinates to which to set the location of the upper left corner of the outer bounds of this Rectangle2D
w - the value to use to set the width of the outer bounds of this Rectangle2D
h - the value to use to set the height of the outer bounds of this Rectangle2D
Since:
1.2
See Also:
RectangularShape.getFrame() sample code for java.awt.geom.RectangularShape.getFrame() definition code for java.awt.geom.RectangularShape.getFrame()

getBounds2D sample code for java.awt.geom.Rectangle2D.getBounds2D() definition code for java.awt.geom.Rectangle2D.getBounds2D()

public Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D  getBounds2D()
Returns the high precision bounding box of this 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()

contains sample code for java.awt.geom.Rectangle2D.contains(double, double) definition code for java.awt.geom.Rectangle2D.contains(double, double)

public boolean contains(double x,
                        double y)
Tests if a specified coordinate is inside the boundary of this Rectangle2D.

Parameters:
x, y - the coordinates to test
Returns:
true if the specified coordinates are inside the boundary of this Rectangle2D; false otherwise.
Since:
1.2

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)

public 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.

Parameters:
x, y - the coordinates of the upper left corner of the specified set of rectangular coordinates
w - the width of the specified set of rectangular coordinates
h - the height of the specified set of rectangular coordinates
Returns:
true if this Rectangle2D intersects the interior of a specified set of rectangular coordinates; false otherwise.
Since:
1.2
See Also:
Area sample code for java.awt.geom.Area definition code for java.awt.geom.Area

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)

public 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.

Parameters:
x, y - the coordinates of the upper left corner of the specified set of rectangular coordinates
w - the width of the specified set of rectangular coordinates
h - the height of the specified set of rectangular coordinates
Returns:
true if this Rectangle2D entirely contains specified set of rectangular coordinates; false otherwise.
Since:
1.2
See Also:
Area sample code for java.awt.geom.Area definition code for java.awt.geom.Area , Shape.intersects(double, double, double, double) sample code for java.awt.Shape.intersects(double, double, double, double) definition code for java.awt.Shape.intersects(double, double, double, double)

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)

public abstract 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 object representing the intersection of this Rectangle2D with the specified Rectangle2D.

Parameters:
r - the Rectangle2D to be intersected with this Rectangle2D
Returns:
the largest Rectangle2D contained in both the specified Rectangle2D and in this Rectangle2D.
Since:
1.2

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)

public static void intersect(Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D  src1,
                             Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D  src2,
                             Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D  dest)
Intersects the pair of specified source Rectangle2D objects and puts the result into the specified destination Rectangle2D object. One of the source rectangles can also be the destination to avoid creating a third Rectangle2D object, but in this case the original points of this source rectangle will be overwritten by this method.

Parameters:
src1 - the first of a pair of Rectangle2D objects to be intersected with each other
src2 - the second of a pair of Rectangle2D objects to be intersected with each other
dest - the Rectangle2D that holds the results of the intersection of src1 and src2
Since:
1.2

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)

public abstract 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 Rectangle2D with the specified Rectangle2D.

Parameters:
r - the Rectangle2D to be combined with this Rectangle2D
Returns:
the smallest Rectangle2D containing both the specified Rectangle2D and this Rectangle2D.
Since:
1.2

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)

public static void union(Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D  src1,
                         Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D  src2,
                         Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D  dest)
Unions the pair of source Rectangle2D objects and puts the result into the specified destination Rectangle2D object. One of the source rectangles can also be the destination to avoid creating a third Rectangle2D object, but in this case the original points of this source rectangle will be overwritten by this method.

Parameters:
src1 - the first of a pair of Rectangle2D objects to be combined with each other
src2 - the second of a pair of Rectangle2D objects to be combined with each other
dest - the Rectangle2D that holds the results of the union of src1 and src2
Since:
1.2

add sample code for java.awt.geom.Rectangle2D.add(double, double) definition code for java.awt.geom.Rectangle2D.add(double, double)

public void add(double newx,
                double newy)
Adds a point, specified by the double precision arguments newx and newy, to this Rectangle2D. The resulting Rectangle2D is the smallest Rectangle2D that contains both the original Rectangle2D 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 left or bottom edge of the enlarged rectangle, contains returns false for that point.

Parameters:
newx, newy - the coordinates of the new point
Since:
JDK1.0

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)

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

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 left or bottom edge of the enlarged rectangle, contains returns false for that point.

Parameters:
pt - the new Point2D to add to this Rectangle2D.
Since:
JDK1.0

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)

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

Parameters:
r - the Rectangle2D to add to this Rectangle2D.
Since:
JDK1.0

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)

public PathIterator sample code for java.awt.geom.PathIterator definition code for java.awt.geom.PathIterator  getPathIterator(AffineTransform sample code for java.awt.geom.AffineTransform definition code for java.awt.geom.AffineTransform  at)
Returns an iteration object that defines the boundary of this Rectangle2D. The iterator for this class is multi-threaded safe, which means that this Rectangle2D class guarantees that modifications to the geometry of this Rectangle2D object do not affect any iterations of that geometry that are already in process.

Parameters:
at - an optional AffineTransform to be applied to the coordinates as they are returned in the iteration, or null if untransformed coordinates are desired
Returns:
the PathIterator object that returns the geometry of the outline of this Rectangle2D, one segment at a time.
Since:
1.2

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)

public PathIterator sample code for java.awt.geom.PathIterator definition code for java.awt.geom.PathIterator  getPathIterator(AffineTransform sample code for java.awt.geom.AffineTransform definition code for java.awt.geom.AffineTransform  at,
                                    double flatness)
Returns an iteration object that defines the boundary of the flattened Rectangle2D. Since rectangles are already flat, the flatness parameter is ignored. The iterator for this class is multi-threaded safe, which means that this Rectangle2D class guarantees that modifications to the geometry of this Rectangle2D object do not affect any iterations of that geometry that are already in process.

Specified by:
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) in interface Shape sample code for java.awt.Shape definition code for java.awt.Shape
Overrides:
getPathIterator sample code for java.awt.geom.RectangularShape.getPathIterator(java.awt.geom.AffineTransform, double) definition code for java.awt.geom.RectangularShape.getPathIterator(java.awt.geom.AffineTransform, double) in class RectangularShape sample code for java.awt.geom.RectangularShape definition code for java.awt.geom.RectangularShape
Parameters:
at - an optional AffineTransform to be applied to the coordinates as they are returned in the iteration, or null if untransformed coordinates are desired
flatness - the maximum distance that the line segments used to approximate the curved segments are allowed to deviate from any point on the original curve. Since rectangles are already flat, the flatness parameter is ignored.
Returns:
the PathIterator object that returns the geometry of the outline of this Rectangle2D, one segment at a time.
Since:
1.2

hashCode sample code for java.awt.geom.Rectangle2D.hashCode() definition code for java.awt.geom.Rectangle2D.hashCode()

public int hashCode()
Returns the hashcode for this Rectangle2D.

Overrides:
hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() in class Object sample code for java.lang.Object definition code for java.lang.Object
Returns:
the hashcode for this Rectangle2D.
See Also:
Object.equals(java.lang.Object) sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , Hashtable sample code for java.util.Hashtable definition code for java.util.Hashtable

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

public boolean equals(Object sample code for java.lang.Object definition code for java.lang.Object  obj)
Determines whether or not the specified Object is equal to this Rectangle2D. The specified Object is equal to this Rectangle2D if it is an instance of Rectangle2D and if its location and size are the same as this Rectangle2D.

Overrides:
equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) in class Object sample code for java.lang.Object definition code for java.lang.Object
Parameters:
obj - an Object to be compared with this Rectangle2D.
Returns:
true if obj is an instance of Rectangle2D and has the same values; false otherwise.
Since:
1.2
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