|
||||||||
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 java.awt.Color |
color
the color of this shape |
static java.lang.String |
OVAL
|
protected java.awt.Point |
p1
the first point in the shape |
protected java.awt.Point |
p2
the second point in the shape |
static java.lang.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(java.awt.Point firstPoint,
java.awt.Point secondPoint)
Constructor that takes the first and second point |
Method Summary | |
---|---|
abstract void |
draw(java.awt.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 java.lang.String RECTANGLE
public static final java.lang.String OVAL
protected java.awt.Color color
protected java.awt.Point p1
protected java.awt.Point p2
Constructor Detail |
---|
public AbstractShape()
public AbstractShape(java.awt.Point firstPoint, java.awt.Point secondPoint)
firstPoint
- the first point that defines the shapesecondPoint
- the second point that defines the shapepublic 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 shapeMethod 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 1public void setPoint2Values(int newX, int newY)
newX
- the new x value for point 2newY
- the new y value for point 2public abstract void draw(java.awt.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 |