Index (Frames) | Index (No Frames) | Package | Package Tree | Tree
java.awt.geom

Class Rectangle2D.Float

java.lang.Object
|
+--java.awt.geom.RectangularShape
   |
   +--java.awt.geom.Rectangle2D
      |
      +--java.awt.geom.Rectangle2D.Float


public static class Rectangle2D.Float

extends Rectangle2D

This class defines a rectangle in float precision.

Since:Author:

Field Summary

floatheight

The height of the rectangle.
floatwidth

The width of the rectangle.
floatx

The x coordinate of the lower left corner.
floaty

The y coordinate of the lower left corner.

Constructor Summary

Float()

Create a rectangle at (0,0) with width 0 and height 0.
Float(float x, float y, float w, float h)

Create a rectangle with the given values.

Method Summary

java.awt.geom.Rectangle2DcreateIntersection(java.awt.geom.Rectangle2D r)

Return a new rectangle which is the intersection of this and the given one.
java.awt.geom.Rectangle2DcreateUnion(java.awt.geom.Rectangle2D r)

Return a new rectangle which is the union of this and the given one.
java.awt.geom.Rectangle2DgetBounds2D()

Returns the bounds of this rectangle.
doublegetHeight()

Return the height.
doublegetWidth()

Return the width.
doublegetX()

Return the X coordinate.
doublegetY()

Return the Y coordinate.
booleanisEmpty()

Test if the rectangle is empty.
intoutcode(double x, double y)

Determine where the point lies with respect to this rectangle.
voidsetRect(float x, float y, float w, float h)

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

Set the contents of this rectangle to those specified.
voidsetRect(java.awt.geom.Rectangle2D r)

Set the contents of this rectangle to those specified.
java.lang.StringtoString()

Returns a string representation of this rectangle.

Field Details

height

public float height

The height of the rectangle.


width

public float width

The width of the rectangle.


x

public float x

The x coordinate of the lower left corner.


y

public float y

The y coordinate of the lower left corner.


Constructor Details

Float

public Float()

Create a rectangle at (0,0) with width 0 and height 0.


Float

public Float(float x, float y, float w, float h)

Create a rectangle with the given values.

Parameters:


Method Details

createIntersection

public Rectangle2D createIntersection(java.awt.geom.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.

Parameters:

Returns:

Throws:


createUnion

public Rectangle2D createUnion(java.awt.geom.Rectangle2D r)

Return a new rectangle which is the union of this and the given one.

Parameters:

Returns:

Throws:


getBounds2D

public Rectangle2D getBounds2D()

Returns the bounds of this rectangle. A pretty useless method, as this is already a rectangle.

Returns:


getHeight

public double getHeight()

Return the height.

Returns:


getWidth

public double getWidth()

Return the width.

Returns:


getX

public double getX()

Return the X coordinate.

Returns:


getY

public double getY()

Return the Y coordinate.

Returns:


isEmpty

public boolean isEmpty()

Test if the rectangle is empty.

Returns:


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.

Since:Parameters:

Returns:

See Also:


setRect

public void setRect(double x, double y, double w, double h)

Set the contents of this rectangle to those specified.

Parameters:


setRect

public void setRect(float x, float y, float w, float h)

Set the contents of this rectangle to those specified.

Parameters:


setRect

public void setRect(java.awt.geom.Rectangle2D r)

Set the contents of this rectangle to those specified.

Parameters:

Throws:


toString

public String toString()

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

Returns: