|
|||||||
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()
Constructs an empty rectangle. |
|
Rectangle(double x,
double y,
double width,
double height)
Constructs a rectangle. |
Method Summary | |
---|---|
void |
draw()
Shows this shape on the canvas. |
double |
getHeight()
Gets the height of this rectangle. |
double |
getWidth()
Gets the width of this rectangle. |
double |
getX()
Gets the leftmost x-position of this rectangle. |
double |
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 |
setDrawColor(Color newColor)
Sets the color for drawing the outline of this rectangle. |
void |
setFillColor(Color newColor)
Sets the color for filling the interior of this rectangle. |
void |
translate(double dx,
double dy)
Moves this rectangle by a given amount. |
Methods inherited from class |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Rectangle()
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 double getHeight()
getHeight
in interface Shape
public double getWidth()
getWidth
in interface Shape
public double getX()
getX
in interface Shape
public double 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 setDrawColor(Color newColor)
newColor
- the new draw colorpublic void setFillColor(Color newColor)
newColor
- the new fill colorpublic 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 |