public abstract class Rectangle2D extends RectangularShape
Modifier and Type | Class and Description |
---|---|
static class |
Rectangle2D.Double
A Rectangle2D with double coordinates
|
static class |
Rectangle2D.Float
A Rectangle2D with float coordinates.
|
Modifier and Type | Field and Description |
---|---|
static int |
OUT_BOTTOM
The bitmask that indicates that a point lies below this rectangle.
|
static int |
OUT_LEFT
The bitmask that indicates that a point lies to the left of
this rectangle.
|
static int |
OUT_RIGHT
The bitmask that indicates that a point lies to the right of this rectangle.
|
static int |
OUT_TOP
The bitmask that indicates that a point lies above this rectangle.
|
Modifier | Constructor and Description |
---|---|
protected |
Rectangle2D()
This is an abstract class which cannot be instantiated: use Rectangle2D.Float, Rectangle2D.Double, or Rectangle.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(double x,
double y)
Test if this Rectangle2D contains a rectangle defined by double coordinates
|
boolean |
contains(double x,
double y,
double w,
double h)
Test if the shape contains the rectangle with top left at (x,y), width w and height h.
|
boolean |
equals(java.lang.Object obj)
Test if the rectangle is equal to a given object
|
boolean |
intersects(double x,
double y,
double w,
double h)
Test if this Rectangle2D intersects a rectangle defined by double coordinates
|
boolean |
intersectsLine(double x1,
double y1,
double x2,
double y2)
Test if this rectangle intersects a given line
|
abstract int |
outcode(double x,
double y)
Returns a mask value that specifies where a point lies with respect
to this rectangle.
|
int |
outcode(Point2D p)
Returns a mask value that specifies where a given point lies with respect
to this rectangle.
|
void |
setFrame(double x,
double y,
double w,
double h)
Set the frame for the rectangular shape
|
abstract void |
setRect(double x,
double y,
double w,
double h)
Set this rectangle to a rectangle defined by double coordinates
|
void |
setRect(Rectangle2D r)
Set this Rectangle2D to be the same as a given Rectangle2D
|
clone, contains, contains, getBounds, getCenterX, getCenterY, getFrame, getHeight, getMaxX, getMaxY, getMinX, getMinY, getWidth, getX, getY, intersects, isEmpty, setFrame
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getBounds2D
public static final int OUT_LEFT
public static final int OUT_TOP
public static final int OUT_RIGHT
public static final int OUT_BOTTOM
protected Rectangle2D()
public boolean contains(double x, double y, double w, double h)
Shape
x
- the x-coordinate of the top left point of the rectangley
- the y-coordinate of the top left point of the rectanglew
- the width of the rectangleh
- the height of the rectanglepublic abstract void setRect(double x, double y, double w, double h)
x
- the x coordinate of the top left cornery
- the y coordinate of the top right cornerw
- the width of the rectangleh
- the height of the rectanglepublic void setRect(Rectangle2D r)
r
- the Rectangle2Dpublic void setFrame(double x, double y, double w, double h)
RectangularShape
setFrame
in class RectangularShape
x
- the x coordinate of the top left cornery
- the y coordinate iof the top left cornerw
- the widthh
- the heightpublic boolean contains(double x, double y)
x
- the x co-ordinate of the pointy
- the y co-ordinate of the pointpublic boolean intersects(double x, double y, double w, double h)
x
- the x-coordinate of the top left point of the rectangley
- the y-coordinate of the top left point of the rectanglew
- the width of the rectangleh
- the height of the rectanglepublic boolean intersectsLine(double x1, double y1, double x2, double y2)
x1
- the x coordinate of the start of the given liney1
- the y coordinate of the start of the given linex2
- the x coordinate of the end of the given liney2
- the y coordinate of the end of the given linepublic int outcode(Point2D p)
p
- the given pointpublic abstract int outcode(double x, double y)
x
- the x coordinate of the given pointy
- the y coordinate of the given pointpublic boolean equals(java.lang.Object obj)
equals
in class java.lang.Object