|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectm865.shapepack.Shape
m865.shapepack.Rectangle
m865.shapepack.Square
public class Square
The Square subclass of Rectangle.
Field Summary |
---|
Fields inherited from class m865.shapepack.Shape |
---|
color, defaultColor, defaultHeight, defaultWidth, height, width, x, y |
Constructor Summary | |
---|---|
Square(int x,
int y)
Constructor for a square at the specified location with the default width (and height) and color. |
|
Square(int x,
int y,
int w,
java.awt.Color c)
The generic Square constructor. |
Method Summary | |
---|---|
void |
setHeight(int h)
Set the height of the square. |
void |
setWidth(int w)
Set the width of the square. |
java.lang.String |
toString()
Generates the string describing the rectangle. |
Methods inherited from class m865.shapepack.Rectangle |
---|
area, draw, perimeter |
Methods inherited from class m865.shapepack.Shape |
---|
getColor, getHeight, getWidth, getX, getY, moveTo, setColor |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Square(int x, int y, int w, java.awt.Color c)
x
- horizontal coordinate of the upper left corner of the square.y
- vertical coordinate of the upper left corner of the square.w
- width (and height) of the square.c
- fill color for the rectangle.public Square(int x, int y)
x
- horizontal coordinate of the upper left corner of the square.y
- vertical coordinate of the upper left corner of the square.Method Detail |
---|
public void setWidth(int w)
setWidth
in class Shape
w
- the new width (and height) of the square.public void setHeight(int h)
setHeight
in class Shape
h
- the new height (and width) of the square.public java.lang.String toString()
Rectangle
toString
in class Rectangle
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |