|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectRectangle
public class Rectangle
Constructor Summary | |
---|---|
Rectangle(double x,
double y,
double width,
double height)
Constructs a rectangle. |
Method Summary | |
---|---|
void |
draw()
Draws this rectangle. |
void |
fill()
Fills this rectangle. |
int |
getHeight()
Gets the height of this rectangle. |
int |
getWidth()
Gets the width of this rectangle. |
int |
getX()
Gets the leftmost x-position of this rectangle. |
int |
getY()
Gets the topmost y-position of this rectangle. |
void |
grow(double dw,
double dh)
Resizes this rectangle both horizontally and vertically. |
void |
paintShape(Graphics2D g2)
Paints the shape |
void |
setColor(Color newColor)
Sets the color of this rectangle. |
String |
toString()
|
void |
translate(double dx,
double dy)
Moves this rectangle by a given amount. |
Methods inherited from class |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Rectangle(double x, double y, double width, double height)
x
- the leftmost x-coordinatey
- the topmost y-coordinatewidth
- the widthheight
- the heightMethod Detail |
---|
public void draw()
public void fill()
public int getHeight()
getHeight
in interface Shape
public int getWidth()
getWidth
in interface Shape
public int getX()
getX
in interface Shape
public int getY()
getY
in interface Shape
public void grow(double dw, double dh)
dw
- the amount by which to resize the width on each sidedw
- the amount by which to resize the height on each sidepublic void paintShape(Graphics2D g2)
Shape
paintShape
in interface Shape
g2
- the graphics objectpublic void setColor(Color newColor)
newColor
- the new colorpublic String toString()
toString
in class Object
public void translate(double dx, double dy)
dx
- the amount by which to move in x-directiondy
- the amount by which to move in y-direction
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |