|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectwheels.etc.AbstractGraphic
wheels.users.Shape
Generic superclass for all Wheels graphics. Subclasses must pass
an instance of java.awt.Shape to super to
define the Shape's shape and define
actualPaint to paint the shape.
| Field Summary | |
protected DrawingPanel |
_dp
The wheels.etc.DrawingPanel in which the shape will
be drawn. |
protected Shape |
_shape
The java.awt.Shape that defines the look of the shape |
static Color |
DEFAULT_COLOR
|
| Constructor Summary | |
Shape(Shape shape)
Constructs a shape in the wheels.users.Frame's DrawingPanel, with color DEFAULT_COLOR. |
|
Shape(Shape shape,
DrawingPanel dp)
Constructs a Shape with the passed-in shape in the specified DrawingPanel. |
|
| Method Summary | |
abstract void |
actualPaint(Graphics2D g)
Subclasses must define this to do the actual painting of the shape. |
boolean |
contains(Point p)
Returns a boolean indicating whether or not the Shape contains the passed-in point. |
Rectangle |
getBounds()
Normal users do not need to worry about this! Returns a java.awt.Rectangle that bounds the shape. |
Color |
getColor()
Returns the shape's color. |
int |
getRotation()
Returns the Shape's current rotation in degrees. |
void |
hide()
Hides the shape graphically. |
void |
paint(Graphics2D g)
This is the methid the DrawingPanel will call when the shape needs to display itself. |
void |
setColor(Color c)
Sets the color of the shape. |
void |
setRotation(int degrees)
Set the rotation of the shape. |
void |
show()
Displays the shape graphically. |
| Methods inherited from class wheels.etc.AbstractGraphic |
mouseClicked, mouseDragged, mousePressed, mouseReleased |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected DrawingPanel _dp
wheels.etc.DrawingPanel in which the shape will
be drawn.
protected Shape _shape
java.awt.Shape that defines the look of the shape
public static final Color DEFAULT_COLOR
| Constructor Detail |
public Shape(Shape shape)
shape - the shape that describes our Shape
public Shape(Shape shape,
DrawingPanel dp)
shape - the shape that describes our Shapedp - the wheels.etc.DrawingPanel in which the shape will be
drawn| Method Detail |
public void hide()
public void show()
public void paint(Graphics2D g)
java.awt.Graphics2D up to
draw the shape at the proper rotation and calls
actualPaint(g).
paint in interface CustomGraphicg - the instance of java.awt.Graphics2D that should
be used to paint the shapepublic abstract void actualPaint(Graphics2D g)
paint(java.awt.Graphics2D) will forward to
this method.
g - the instance of java.awt.Graphics2D that should
be used to paint the shapepublic void setColor(Color c)
setColor in interface Colorablepublic Color getColor()
getColor in interface Colorablepublic void setRotation(int degrees)
setRotation in interface Rotatabledegrees - the magnitude of the rotation in degreespublic int getRotation()
getRotation in interface Rotatablepublic Rectangle getBounds()
java.awt.Rectangle that bounds the shape.
public boolean contains(Point p)
contains in interface CustomGraphicp - the point
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||