|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.ObjectAbstractShape
public abstract class AbstractShape
Class AbstractShape: abstract class for shapes that can be represented with 2 points Copyright Georgia Institute of Technology 2007
| Field Summary | |
|---|---|
protected Color |
color
the color of this shape |
static String |
OVAL
|
protected Point |
p1
the first point in the shape |
protected Point |
p2
the second point in the shape |
static String |
RECTANGLE
|
| Constructor Summary | |
|---|---|
AbstractShape()
Constructor that takes no arguments |
|
AbstractShape(int x1,
int y1,
int x2,
int y2)
Constructor that takes x1,y1,x2,y2 |
|
AbstractShape(Point firstPoint,
Point secondPoint)
Constructor that takes the first and second point |
|
| Method Summary | |
|---|---|
abstract void |
draw(Graphics g)
Abstract method to draw the shape given the graphics context |
int |
getHeight()
Method to get the height of the bounding rectangle |
int |
getMinX()
Method to get minimum x value of the bounding rectangle |
int |
getMinY()
Method to get the minimum y value of the bounding rectangle |
int |
getWidth()
Method to get the width of the bounding rectangle |
void |
setPoint1Values(int newX,
int newY)
Method to set the point values for point1 that defines the shape |
void |
setPoint2Values(int newX,
int newY)
Method to set the point values for point2 that defines the shape |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String RECTANGLE
public static final String OVAL
protected Color color
protected Point p1
protected Point p2
| Constructor Detail |
|---|
public AbstractShape()
public AbstractShape(Point firstPoint,
Point secondPoint)
firstPoint - the first point that defines the shapesecondPoint - the second point that defines the shape
public AbstractShape(int x1,
int y1,
int x2,
int y2)
x1 - x value of the first point that defines the shapey1 - y value of the first point that defines the shapex2 - x value of the second point that defines the shapey2 - y value of the second point that defines the shape| Method Detail |
|---|
public int getMinX()
public int getMinY()
public int getWidth()
public int getHeight()
public void setPoint1Values(int newX,
int newY)
newX - the new x value for point 1newY - the new y value for point 1
public void setPoint2Values(int newX,
int newY)
newX - the new x value for point 2newY - the new y value for point 2public abstract void draw(Graphics g)
g - the graphics context to draw the shape on
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||