java.awt.geom
Class Rectangle2D.Float

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

public static class Rectangle2D.Float
extends Rectangle2D

A Rectangle2D with float coordinates.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.geom.Rectangle2D
Rectangle2D.Double, Rectangle2D.Float
 
Field Summary
 float height
          The height of the rectangle;
 float width
          The width of the rectangle
 float x
          The x coordinate of the top left corner
 float 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.Float()
          Create an empty rectangle at (0,0)
Rectangle2D.Float(float x, float y, float width, float height)
          Create a rectangle with float coordinates
 
Method Summary
 Rectangle2D getBounds2D()
          Get the bounds as a Rectangle2D with float coordinates
 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 setRect(double x, double y, double w, double h)
          Set this rectangle to a rectangle defined by double coordinates
 void setRect(float x, float y, float w, float h)
          Set the rectangle using float 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, setFrame
 
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 float x
The x coordinate of the top left corner


y

public float y
The y coordinate of the top right corner


width

public float width
The width of the rectangle


height

public float height
The height of the rectangle;

Constructor Detail

Rectangle2D.Float

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


Rectangle2D.Float

public Rectangle2D.Float(float x,
                         float y,
                         float width,
                         float height)
Create a rectangle with float coordinates

Parameters:
x - the x coordinate of the top left corner
y - the y coordinate of the top left corner
width - the width of the rectangle
height - the height of the rectangle
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

getBounds2D

public Rectangle2D getBounds2D()
Get the bounds as a Rectangle2D with float coordinates

Returns:
the bounding rectangle

setRect

public void setRect(float x,
                    float y,
                    float w,
                    float h)
Set the rectangle using float coordinates

Parameters:
x - the x coordinate of the top left corner
y - the y coordinate of the top left corner
w - the width
h - the height

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

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

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