|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--DrawableShape
CLASS: DrawableShape
PURPOSE: Serve as a super class for other shape, force the subclass to have method
for drawing and editing.
IMPORT: java.awt.Graphics, java.awt.Color, java.util.Vector, Point
EXPORT: None, This is an abstract class with partial implementation. User
should not instantiate this class. Some basic functions have already
been implemented: addPoint, getColor, move, movePointBox,
removeLastPoint, setColor, setEndPoint, setFill, setSelected,
setStartPoint
Field Summary | |
protected boolean |
bFill
Flag to indicate the shape is to be filled or not |
protected boolean |
bSelected
Flag to indicate if the shape has been selected |
protected java.awt.Color |
color
Color for the shape |
protected java.util.Vector |
pointList
Vector to keep track of the shapes point(s) |
protected Point |
xPointChange
Reference Point object for resize change(X component) |
protected Point |
yPointChange
Reference Point object for resize change(Y component) |
Constructor Summary | |
DrawableShape()
|
Method Summary | |
void |
addPoint(Point pt)
PRE: A valid Point object POST: Add a new point to the point list. |
abstract DrawableShape |
copyClone()
PRE: None POST: A new DrawableShape object is copy from the current instance and returned |
java.awt.Color |
getColor()
PRE: None POST: Return the color of the shape |
int |
getLeastX()
PRE: None POST: Return the least value for x in the point list |
int |
getLeastY()
PRE: None POST: Return the least value for y in the point list |
abstract boolean |
hitTest(Point p)
PRE: A valid Point Object POST: Check to see if the point hit the shape |
abstract boolean |
hitTestPointBox(Point p)
PRE: A valid Point object POST: Return true if the point hit the Point Box |
void |
move(int deltaX,
int deltaY)
PRE: None POST: Move the shape offset by the input x and y |
void |
movePointBox(int deltaX,
int deltaY)
PRE: None POST: Resize the shape by offset the reference point(s) by the input x and y |
abstract void |
paint(java.awt.Graphics g)
PRE: A valid Graphics object to paint on POST: Current object will be draw using the Graphics object |
void |
removeLastPoint()
PRE: None POST: Remove the last point from the point list (if any) |
void |
setColor(java.awt.Color color)
PRE: A valid Color Object POST: Set the color of the shape from the input |
void |
setEndPoint(Point p)
PRE: A valid Point Object POST: Set the endPoint of the shape from the input |
void |
setFill(boolean b)
PRE: None POST: Set the private variable bFill as the input |
void |
setSelected(boolean b)
PRE: None POST: Set the shape flag to indicate whether it has been selected or not |
void |
setStartPoint(Point p)
PRE: A valid Point Object POST: Set the startPoint of the shape from the input |
Methods inherited from class java.lang.Object |
|
Field Detail |
protected Point xPointChange
protected Point yPointChange
protected java.util.Vector pointList
protected java.awt.Color color
protected boolean bFill
protected boolean bSelected
Constructor Detail |
public DrawableShape()
Method Detail |
public abstract DrawableShape copyClone()
public abstract void paint(java.awt.Graphics g)
public abstract boolean hitTest(Point p)
public abstract boolean hitTestPointBox(Point p)
public void setStartPoint(Point p)
public void setEndPoint(Point p)
public void setColor(java.awt.Color color)
public void setFill(boolean b)
public void setSelected(boolean b)
public void move(int deltaX, int deltaY)
public void addPoint(Point pt)
public void movePointBox(int deltaX, int deltaY)
public void removeLastPoint()
public java.awt.Color getColor()
public int getLeastX()
public int getLeastY()
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |