java.awt.geom
public static class Rectangle2D.Double extends Rectangle2D
double
precision.Rectangle2D.Double, Rectangle2D.Float
Modifier and Type | Field and Description |
---|---|
double |
height
The height of the rectangle.
|
double |
width
The width of the rectangle.
|
double |
x
The x coordinate of the lower left corner.
|
double |
y
The y coordinate of the lower left corner.
|
OUT_BOTTOM, OUT_LEFT, OUT_RIGHT, OUT_TOP
Constructor and Description |
---|
Rectangle2D.Double()
Create a rectangle at (0,0) with width 0 and height 0.
|
Rectangle2D.Double(double x,
double y,
double w,
double h)
Create a rectangle with the given values.
|
Modifier and Type | Method and Description |
---|---|
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(Rectangle2D r)
Set the contents of this rectangle to those specified.
|
String |
toString()
Returns a string representation of this rectangle.
|
add, add, add, contains, contains, equals, getPathIterator, getPathIterator, hashCode, intersect, intersects, intersectsLine, intersectsLine, outcode, setFrame, union
clone, contains, contains, getBounds, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal
public double x
public double y
public double width
public double height
public Rectangle2D.Double()
public Rectangle2D.Double(double x, double y, double w, double h)
x
- the x coordinatey
- the y coordinatew
- the widthh
- the heightpublic double getX()
getX
in class RectangularShape
public double getY()
getY
in class RectangularShape
public double getWidth()
getWidth
in class RectangularShape
public double getHeight()
getHeight
in class RectangularShape
public boolean isEmpty()
isEmpty
in class RectangularShape
public void setRect(double x, double y, double w, double h)
setRect
in class Rectangle2D
x
- the x coordinatey
- the y coordinatew
- the widthh
- the heightpublic void setRect(Rectangle2D r)
setRect
in class Rectangle2D
r
- the rectangle to copyNullPointerException
- if r is nullpublic int outcode(double x, double y)
outcode
in class Rectangle2D
x
- the x coordinate to checky
- the y coordinate to checkRectangle2D.OUT_LEFT
,
Rectangle2D.OUT_TOP
,
Rectangle2D.OUT_RIGHT
,
Rectangle2D.OUT_BOTTOM
public Rectangle2D getBounds2D()
getBounds2D
in interface Shape
getBounds2D
in class Rectangle2D
Shape.getBounds()
public Rectangle2D createIntersection(Rectangle2D r)
createIntersection
in class Rectangle2D
r
- the rectangle to be intersectedNullPointerException
- if r is nullpublic Rectangle2D createUnion(Rectangle2D r)
createUnion
in class Rectangle2D
r
- the rectangle to be mergedNullPointerException
- if r is nullpublic String toString()
getClass().getName() + "[x=" + x + ",y=" + y + ",w=" + width
+ ",h=" + height + ']'
.toString
in class Object
Object.getClass()
,
Object.hashCode()
,
Class.getName()
,
Integer.toHexString(int)