is new.
java.lang.Objectjava.awt.geom.RectangularShape
java.awt.geom.Rectangle2D
java.awt.geom.Rectangle2D.Float
,
Serializable
,
Cloneable
public static class Rectangle2D.Float
implements
SerializableThe Float class defines a rectangle specified in float coordinates.
See Also:
Serialized Form
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.awt.geom. Rectangle2D |
|---|
| Rectangle2D.Double , Rectangle2D.Float |
| Field Summary | |
|---|---|
| float |
height
The height of this Rectangle2D. |
| float |
width
The width of this Rectangle2D. |
| float |
x
The
X
|
| float |
y
The
Y
|
| Fields inherited from class java.awt.geom. Rectangle2D |
|---|
| OUT_BOTTOM , OUT_LEFT , OUT_RIGHT , OUT_TOP |
| Constructor Summary | |
|---|---|
|
Rectangle2D.Float
() Constructs a new Rectangle2D, initialized to location (0.0, 0.0) and size (0.0, 0.0). |
|
|
Rectangle2D.Float
(float x, float y, float w, float h) Constructs and initializes a Rectangle2D from the specified float coordinates. |
|
| Method Summary | |
|---|---|
| Rectangle2D |
createIntersection
(
Rectangle2D
Returns a new Rectangle2D object representing the intersection of this Rectangle2D with the specified Rectangle2D. |
| Rectangle2D |
createUnion
(
Rectangle2D
Returns a new Rectangle2D object representing the union of this Rectangle2D with the specified Rectangle2D. |
| Rectangle2D |
getBounds2D
() Returns
a
and more accurate
bounding box of
the Shape than the getBounds method.
|
| double |
getHeight
() Returns the height of
the framing rectangle
|
| double |
getWidth
() Returns the width of
the framing rectangle
|
| double |
getX
() Returns the X coordinate of
the upper-left corner of the framing rectangle
|
| double |
getY
() Returns the Y coordinate of
the upper-left corner of the framing rectangle
|
| boolean |
isEmpty
() Determines whether
the RectangularShape
|
| int |
outcode
(double x, double y) Determines where the specified
|
| void |
setRect
(double x, double y, double w, double h) Sets the location and size of this Rectangle2D to the specified double values. |
| void |
setRect
(float x, float y, float w, float h) Sets the location and size of this Rectangle2D to the specified float values. |
| void |
setRect
(
Rectangle2D
r) Sets this Rectangle2D to be the same as the specified Rectangle2D. |
| String |
toString
() Returns the String representation of this Rectangle2D. |
| 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 |
|---|
public float x
X
public float y
Y
public float width
public float height
| Constructor Detail |
|---|
public Rectangle2D.Float()
public Rectangle2D.Float(float x,
float y,
float w,
float h)
x
X coordinate
upper-left
y
Y coordinate
upper-left corner of the
newly constructed Rectangle2D
w - the width of the newly constructed Rectangle2D
| Method Detail |
|---|
public double getX()
the upper-left corner of the framing rectangle
the X coordinate of the upper-left corner of the framing rectangle.
public double getY()
the upper-left corner of the framing rectangle
the Y coordinate of the upper-left corner of the framing rectangle.
public double getWidth()
the framing rectangle
the framing rectangle.
public double getHeight()
the framing rectangle
the framing rectangle.
public boolean isEmpty()
Determines whether the RectangularShape is empty. When the RectangularShape is empty, it encloses no area.
the RectangularShape
public void setRect(float x,
float y,
float w,
float h)
x
X coordinate
upper-left
y - the Y coordinate of the upper-left corner of this Rectangle2D
w
width of this Rectangle2D
h -
public void setRect(double x,
double y,
double w,
double h)
x
X coordinate
upper-left
y - the Y coordinate of the upper-left corner of this Rectangle2D
w
width of this Rectangle2D
h -
public void setRect(Rectangle2D r)
public int outcode(double x,
double y)
x - the specified X coordinate
y - the specified Y coordinate
public Rectangle2D getBounds2D()
Returns a high precision and more accurate bounding box of the Shape than the getBounds method. Note that there is no guarantee that the returned
Rectangle2D
is the smallest bounding box that encloses the Shape, only that the Shape lies entirely within the indicated Rectangle2D. The bounding box returned by this method is usually tighter than that returned by the getBounds method and never fails due to overflow problems since the return value can be an instance of the Rectangle2D that uses double precision values to store the dimensions.
an instance of Rectangle2D that is a high-precision bounding box of the Shape.
public Rectangle2D createIntersection(Rectangle2D r)
to be
public Rectangle2D createUnion(Rectangle2D r)
public String toString()