|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.Rectangle
public class Rectangle
Minimal Rectangle implementation.
| Field Summary | |
|---|---|
int |
height
|
int |
width
|
int |
x
|
int |
y
|
| Constructor Summary | |
|---|---|
Rectangle()
Creates an empty rectangle at (0,0). |
|
Rectangle(int width,
int height)
Creates a rectangle with top left corner at (0,0) and with specified width and height. |
|
Rectangle(int x,
int y,
int width,
int height)
Creates a rectangle with top left corner at (x,y) and with specified width and height. |
|
| Method Summary | |
|---|---|
boolean |
contains(int pointX,
int pointY)
Test if a point given by (x,y) coordinates are with the rectangle |
boolean |
contains(Rectangle r)
Test if this rectangle contains a specified rectangle |
double |
getHeight()
Get the height as a double |
double |
getWidth()
Get the width as a double |
double |
getX()
Get the x coordinate as a double |
double |
getY()
Get the y coordinate as a double |
boolean |
intersects(Rectangle r)
Test if this rectangle intersects a specified rectangle |
boolean |
isEmpty()
Test if the rectangle is empty |
void |
setLocation(int x,
int y)
Move the rectangle to (x,y) |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public int height
public int width
public int x
public int y
| Constructor Detail |
|---|
public Rectangle(int x,
int y,
int width,
int height)
x - the x coordinate of the top left cornery - the y coordinate of the top left cornerwidth - the width of the rectangleheight - the height of the rectangle
public Rectangle(int width,
int height)
width - the width of the rectangleheight - the height of the rectanglepublic Rectangle()
| Method Detail |
|---|
public double getX()
public double getY()
public double getWidth()
public double getHeight()
public void setLocation(int x,
int y)
x - the new x coordinatey - the new y coordinatepublic boolean isEmpty()
public boolean contains(int pointX,
int pointY)
pointX - the x coordinatepointY - the y coordinate
public boolean contains(Rectangle r)
r - the specified rectangle
public boolean intersects(Rectangle r)
r - the given rectangle
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||