|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjaron.gui.Rect
public class Rect
The Rect
class represents a rectangle in a coordinate system.
It is defined by its upper left corner (top, left), a width and a height.
Constructor Summary | |
---|---|
Rect()
Creates an new Rect object. |
|
Rect(int left,
int top,
int width,
int height)
Creates an new Rect object. |
Method Summary | |
---|---|
java.lang.Boolean |
contains(int x,
int y)
Checks whether or not this Rect contains the point at the
specified location (x,y). |
Rect |
createIntersection(Rect rect)
Computes the intersection of this Rectangle with the specified Rect . |
int |
getHeight()
Returns the height of the Rect . |
int |
getLeft()
Returns the x coordinate of the Rect . |
int |
getTop()
Returns the y coordinate of the Rect . |
int |
getWidth()
Returns the width of the Rect . |
void |
setHeight(int height)
Sets the height of the Rect . |
void |
setLeft(int left)
Sets the x coordinate of the Rect . |
void |
setLocation(int left,
int top)
Moves the Rect to the specified location. |
void |
setSize(int width,
int height)
Sets the width and height of the Rect. |
void |
setTop(int top)
Sets the y coordinate of the Rect . |
void |
setWidth(int width)
Sets the width of the Rect . |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Rect(int left, int top, int width, int height)
Rect
object.
left
- the x coordinatetop
- the y coordinatewidth
- the widthheight
- the heightpublic Rect()
Rect
object. Its coordinates, its width and
and height are set to 0.
Method Detail |
---|
public java.lang.Boolean contains(int x, int y)
Rect
contains the point at the
specified location (x,y).
x
- the specified x coordinatey
- the specified y coordinate
public Rect createIntersection(Rect rect)
Rect
.Rect
that represents the intersection of the two
rectangles. If the two rectangles do not intersect, the result will be an empty
rectangle.
rect
- the specified Rect
Rect
contained in both the specified
Rect
and in this Rect
; or if the rectangles
do not intersect, an empty rectangle.public int getHeight()
Rect
.
public int getLeft()
Rect
.
public int getTop()
Rect
.
public int getWidth()
Rect
.
public void setHeight(int height)
Rect
.
height
- the heightpublic void setLeft(int left)
Rect
.
left
- the x coordinatepublic void setLocation(int left, int top)
left
- the x coordinate of the new locationtop
- the y coordinate of the new locationpublic void setSize(int width, int height)
width
- the new widthheight
- the new heightpublic void setTop(int top)
Rect
.
top
- the y coordinatepublic void setWidth(int width)
Rect
.
width
- the width
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |