|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.geom.RectangularShape
java.awt.geom.Rectangle2D
public abstract class Rectangle2D
An abstract class for a Rectangle. Subclasses use float, double or integer coordinates.
| Nested Class Summary | |
|---|---|
static class |
Rectangle2D.Double
A Rectangle2D with double coordinates |
static class |
Rectangle2D.Float
A Rectangle2D with float coordinates. |
| Field Summary | |
|---|---|
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. |
| Constructor Summary | |
|---|---|
protected |
Rectangle2D()
This is an abstract class which cannot be instantiated: use Rectangle2D.Float, Rectangle2D.Double, or Rectangle. |
| Method Summary | |
|---|---|
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(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 |
| Methods inherited from class java.awt.geom.RectangularShape |
|---|
clone, contains, contains, getBounds, getCenterX, getCenterY, getFrame, getHeight, getMaxX, getMaxY, getMinX, getMinY, getWidth, getX, getY, intersects, isEmpty, setFrame |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.awt.Shape |
|---|
getBounds2D |
| Field Detail |
|---|
public static final int OUT_LEFT
public static final int OUT_TOP
public static final int OUT_RIGHT
public static final int OUT_BOTTOM
| Constructor Detail |
|---|
protected Rectangle2D()
| Method Detail |
|---|
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 rectangle
public 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 Rectangle2D
public void setFrame(double x,
double y,
double w,
double h)
RectangularShape
setFrame in class RectangularShapex - the x coordinate of the top left cornery - the y coordinate iof the top left cornerw - the widthh - the height
public boolean contains(double x,
double y)
x - the x co-ordinate of the pointy - the y co-ordinate of the point
public 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 rectangle
public 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 line
public int outcode(Point2D p)
p - the given point
public abstract int outcode(double x,
double y)
x - the x coordinate of the given pointy - the y coordinate of the given point
public boolean equals(Object obj)
equals in class Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||