java.awt.geom
Class Rectangle2D.Double

java.lang.Object
  extended by java.awt.geom.RectangularShape
      extended by java.awt.geom.Rectangle2D
          extended by java.awt.geom.Rectangle2D.Double
All Implemented Interfaces:
Shape, Cloneable
Enclosing class:
Rectangle2D

public static class Rectangle2D.Double
extends Rectangle2D

A Rectangle2D with double coordinates


Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.geom.Rectangle2D
Rectangle2D.Double, Rectangle2D.Float
 
Field Summary
 double height
          The height of the rectangle;
 double width
          The width of the rectangle
 double x
          The x coordinate of the top left corner
 double y
          The y coordinate of the top right corner
 
Fields inherited from class java.awt.geom.Rectangle2D
OUT_BOTTOM, OUT_LEFT, OUT_RIGHT, OUT_TOP
 
Constructor Summary
Rectangle2D.Double()
          Create an empty rectangle at (0,0)
Rectangle2D.Double(double x, double y, double width, double height)
           
 
Method Summary
 Rectangle2D getBounds2D()
          Get the bounding Rectangle2D for the shape
 double getHeight()
          Get the height as a double
 double getWidth()
          Get the width as a double
 double getX()
          Get the x coordinate as a double
 double getY()
          Get the y coordinate as a double
 boolean isEmpty()
          Test if the rectangular shape is empty
 int outcode(double x, double y)
          Returns a mask value that specifies where a point lies with respect to this rectangle.
 void setFrame(double x, double y, double w, double h)
          Set the frame for the rectangular shape
 void setRect(double x, double y, double w, double h)
          Set this rectangle to a rectangle defined by double coordinates
 void setRect(Rectangle2D r)
          Set this Rectangle2D to be the same as a given Rectangle2D
 
Methods inherited from class java.awt.geom.Rectangle2D
contains, contains, equals, intersects, intersectsLine, outcode
 
Methods inherited from class java.awt.geom.RectangularShape
clone, contains, contains, getBounds, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, intersects, setFrame
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

x

public double x
The x coordinate of the top left corner


y

public double y
The y coordinate of the top right corner


width

public double width
The width of the rectangle


height

public double height
The height of the rectangle;

Constructor Detail

Rectangle2D.Double

public Rectangle2D.Double()
Create an empty rectangle at (0,0)


Rectangle2D.Double

public Rectangle2D.Double(double x,
                          double y,
                          double width,
                          double height)
Method Detail

getX

public double getX()
Description copied from class: RectangularShape
Get the x coordinate as a double

Specified by:
getX in class RectangularShape
Returns:
the x coordinate

getY

public double getY()
Description copied from class: RectangularShape
Get the y coordinate as a double

Specified by:
getY in class RectangularShape
Returns:
the y coordinate

getWidth

public double getWidth()
Description copied from class: RectangularShape
Get the width as a double

Specified by:
getWidth in class RectangularShape
Returns:
the width

getHeight

public double getHeight()
Description copied from class: RectangularShape
Get the height as a double

Specified by:
getHeight in class RectangularShape
Returns:
the height

isEmpty

public boolean isEmpty()
Description copied from class: RectangularShape
Test if the rectangular shape is empty

Specified by:
isEmpty in class RectangularShape
Returns:
true iff the shape is empty

setFrame

public void setFrame(double x,
                     double y,
                     double w,
                     double h)
Description copied from class: RectangularShape
Set the frame for the rectangular shape

Overrides:
setFrame in class Rectangle2D
Parameters:
x - the x coordinate of the top left corner
y - the y coordinate iof the top left corner
w - the width
h - the height

getBounds2D

public Rectangle2D getBounds2D()
Description copied from interface: Shape
Get the bounding Rectangle2D for the shape

Returns:
the bounding Rectangle2D

setRect

public void setRect(double x,
                    double y,
                    double w,
                    double h)
Description copied from class: Rectangle2D
Set this rectangle to a rectangle defined by double coordinates

Specified by:
setRect in class Rectangle2D
Parameters:
x - the x coordinate of the top left corner
y - the y coordinate of the top right corner
w - the width of the rectangle
h - the height of the rectangle

setRect

public void setRect(Rectangle2D r)
Description copied from class: Rectangle2D
Set this Rectangle2D to be the same as a given Rectangle2D

Overrides:
setRect in class Rectangle2D
Parameters:
r - the Rectangle2D

outcode

public int outcode(double x,
                   double y)
Description copied from class: Rectangle2D
Returns a mask value that specifies where a point lies with respect to this rectangle.

Specified by:
outcode in class Rectangle2D
Parameters:
x - the x coordinate of the given point
y - the y coordinate of the given point
Returns:
the mask value