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

Class Rectangle2D.Double

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


public static class Rectangle2D.Double

extends Rectangle2D

This class defines a rectangle in double precision.

Since:Author:

Field Summary

doubleheight

The height of the rectangle.
doublewidth

The width of the rectangle.
doublex

The x coordinate of the lower left corner.
doubley

The y coordinate of the lower left corner.

Constructor Summary

Double()

Create a rectangle at (0,0) with width 0 and height 0.
Double(double x, double y, double w, double 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(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 double height

The height of the rectangle.


width

public double width

The width of the rectangle.


x

public double x

The x coordinate of the lower left corner.


y

public double y

The y coordinate of the lower left corner.


Constructor Details

Double

public Double()

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


Double

public Double(double x, double y, double w, double 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(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: