Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

java.awt.geom
Class Rectangle2D.Float  view Rectangle2D.Float download Rectangle2D.Float.java

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

public static class Rectangle2D.Float
extends Rectangle2D

This class defines a rectangle in float precision.

Since:
1.2

Nested Class Summary
 
Nested classes 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 lower left corner.
 float y
          The y coordinate of the lower left corner.
 
Fields inherited from class java.awt.geom.Rectangle2D
OUT_BOTTOM, OUT_LEFT, OUT_RIGHT, OUT_TOP
 
Constructor Summary
  Rectangle2D.Float()
          Create a rectangle at (0,0) with width 0 and height 0.
(package private) Rectangle2D.Float(double x, double y, double w, double h)
          Create a rectangle with the given values.
  Rectangle2D.Float(float x, float y, float w, float h)
          Create a rectangle with the given values.
 
Method Summary
 Rectangle2D createIntersection(Rectangle2D r)
          Return a new rectangle which is the intersection of this and the given one.
 Rectangle2D createUnion(Rectangle2D r)
          Return a new rectangle which is the union of this and the given one.
 Rectangle2D getBounds2D()
          Returns the bounds of this rectangle.
 double getHeight()
          Return the height.
 double getWidth()
          Return the width.
 double getX()
          Return the X coordinate.
 double getY()
          Return the Y coordinate.
 boolean isEmpty()
          Test if the rectangle is empty.
 int outcode(double x, double y)
          Determine where the point lies with respect to this rectangle.
 void setRect(double x, double y, double w, double h)
          Set the contents of this rectangle to those specified.
 void setRect(float x, float y, float w, float h)
          Set the contents of this rectangle to those specified.
 void setRect(Rectangle2D r)
          Set the contents of this rectangle to those specified.
 java.lang.String toString()
          Returns a string representation of this rectangle.
 
Methods inherited from class java.awt.geom.Rectangle2D
add, add, add, contains, contains, equals, getPathIterator, getPathIterator, hashCode, intersect, intersects, intersectsLine, intersectsLine, outcode, setFrame, union
 
Methods inherited from class java.awt.geom.RectangularShape
clone, contains, contains, getBounds, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

x

public float x
The x coordinate of the lower left corner.


y

public float y
The y coordinate of the lower left 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 a rectangle at (0,0) with width 0 and height 0.


Rectangle2D.Float

public Rectangle2D.Float(float x,
                         float y,
                         float w,
                         float h)
Create a rectangle with the given values.


Rectangle2D.Float

Rectangle2D.Float(double x,
                  double y,
                  double w,
                  double h)
Create a rectangle with the given values.

Method Detail

getX

public double getX()
Return the X coordinate.

Specified by:
getX in class RectangularShape

getY

public double getY()
Return the Y coordinate.

Specified by:
getY in class RectangularShape

getWidth

public double getWidth()
Return the width.

Specified by:
getWidth in class RectangularShape

getHeight

public double getHeight()
Return the height.

Specified by:
getHeight in class RectangularShape

isEmpty

public boolean isEmpty()
Test if the rectangle is empty.

Specified by:
isEmpty in class RectangularShape

setRect

public void setRect(float x,
                    float y,
                    float w,
                    float h)
Set the contents of this rectangle to those specified.


setRect

public void setRect(double x,
                    double y,
                    double w,
                    double h)
Set the contents of this rectangle to those specified.

Specified by:
setRect in class Rectangle2D

setRect

public void setRect(Rectangle2D r)
Set the contents of this rectangle to those specified.

Overrides:
setRect in class Rectangle2D

outcode

public int outcode(double x,
                   double y)
Determine where the point lies with respect to this rectangle. The result will be the binary OR of the appropriate bit masks.

Specified by:
outcode in class Rectangle2D
Since:
1.2

getBounds2D

public Rectangle2D getBounds2D()
Returns the bounds of this rectangle. A pretty useless method, as this is already a rectangle.

Specified by:
getBounds2D in interface java.awt.Shape
Overrides:
getBounds2D in class Rectangle2D

createIntersection

public Rectangle2D createIntersection(Rectangle2D r)
Return a new rectangle which is the intersection of this and the given one. The result will be empty if there is no intersection.

Specified by:
createIntersection in class Rectangle2D

createUnion

public Rectangle2D createUnion(Rectangle2D r)
Return a new rectangle which is the union of this and the given one.

Specified by:
createUnion in class Rectangle2D

toString

public java.lang.String toString()
Returns a string representation of this rectangle. This is in the form getClass().getName() + "[x=" + x + ",y=" + y + ",w=" + width + ",h=" + height + ']'.