|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Rectangle
A rectangle defined by x, y, width and height.
Field Summary | |
int |
height
The height of the rectangle. |
int |
width
The width of the rectangle. |
int |
x
The x coordinate of the rectangle. |
int |
y
The y coordinate of the rectangle. |
Constructor Summary | |
Rectangle()
Constructs a new rectangle. |
|
Rectangle(Dimension d)
Constructs a rectangle and initializes it to the specified width and height. |
|
Rectangle(int width,
int height)
Constructs a rectangle and initializes it with the specified width and height parameters. |
|
Rectangle(int x,
int y,
int width,
int height)
Constructs and initializes a rectangle with the specified parameters. |
|
Rectangle(Point p)
Constructs a rectangle and initializes it to the specified point. |
|
Rectangle(Point p,
Dimension d)
Constructs a rectangle and initializes it to a specified point and dimension. |
Method Summary | |
void |
add(int newx,
int newy)
Adds a point to a rectangle. |
void |
add(Point pt)
Adds a point to a rectangle. |
void |
add(Rectangle r)
Adds a rectangle to a rectangle. |
boolean |
equals(Object obj)
Checks whether two rectangles are equal. |
void |
grow(int h,
int v)
Grows the rectangle horizontally and vertically. |
int |
hashCode()
Returns the hashcode for this Rectangle. |
boolean |
inside(int x,
int y)
Checks if the specified point lies inside a rectangle. |
Rectangle |
intersection(Rectangle r)
Computes the intersection of two rectangles. |
boolean |
intersects(Rectangle r)
Checks if two rectangles intersect. |
boolean |
isEmpty()
Determines whether the rectangle is empty. |
void |
move(int x,
int y)
Moves the rectangle. |
void |
reshape(int x,
int y,
int width,
int height)
Reshapes the rectangle. |
void |
resize(int width,
int height)
Resizes the rectangle. |
String |
toString()
Returns the String representation of this Rectangle's values. |
void |
translate(int x,
int y)
Translates the rectangle. |
Rectangle |
union(Rectangle r)
Computes the union of two rectangles. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public int x
public int y
public int width
public int height
Constructor Detail |
public Rectangle()
public Rectangle(int x, int y, int width, int height)
x
- the x coordinatey
- the y coordinatewidth
- the width of the rectangleheight
- the height of the rectanglepublic Rectangle(int width, int height)
width
- the width of the rectangleheight
- the height of the rectanglepublic Rectangle(Point p, Dimension d)
p
- the pointd
- dimensionpublic Rectangle(Point p)
p
- the value of the x and y coordinatepublic Rectangle(Dimension d)
d
- the value of the width and heightMethod Detail |
public void reshape(int x, int y, int width, int height)
public void move(int x, int y)
public void translate(int x, int y)
public void resize(int width, int height)
public boolean inside(int x, int y)
x
- the x coordinatey
- the y coordinatepublic boolean intersects(Rectangle r)
public Rectangle intersection(Rectangle r)
public Rectangle union(Rectangle r)
public void add(int newx, int newy)
public void add(Point pt)
public void add(Rectangle r)
public void grow(int h, int v)
public boolean isEmpty()
public int hashCode()
hashCode
in class Object
Hashtable
public boolean equals(Object obj)
equals
in class Object
obj
- the Object to compare with
Hashtable
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |