|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectwheelsunh.etc.AbstractGraphic
wheelsunh.users.AbstractShape
wheelsunh.users.Shape
public abstract class 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 java.awt.Color |
_c
|
protected DrawingPanel |
_dp
The wheelsunh.etc.DrawingPanel in which the shape will
be drawn. |
protected java.awt.Shape |
_shape
The java.awt.Shape that defines the look of the shape |
static java.awt.Color |
DEFAULT_COLOR
|
| Fields inherited from class wheelsunh.users.AbstractShape |
|---|
_rot |
| Constructor Summary | |
|---|---|
Shape(java.awt.Shape shape)
Constructs a shape in the wheelsunh.users.Frame's DrawingPanel, with color DEFAULT_COLOR. |
|
Shape(java.awt.Shape shape,
DrawingPanel dp)
Constructs a Shape with the passed-in shape in the specified DrawingPanel. |
|
| Method Summary | |
|---|---|
abstract void |
actualPaint(java.awt.Graphics2D g)
Subclasses must define this to do the actual painting of the shape. |
boolean |
contains(java.awt.Point p)
Returns a boolean indicating whether or not the Shape contains the passed-in point. |
java.awt.Rectangle |
getBounds()
Normal users do not need to worry about this! Returns a java.awt.Rectangle that bounds the shape. |
java.awt.Color |
getColor()
Returns the shape's color. |
abstract java.awt.Point |
getLocation()
Returns the object's location. |
int |
getRotation()
Returns the Shape's current rotation in degrees. |
abstract int |
getXLocation()
Returns the object's x location. |
abstract int |
getYLocation()
Returns the object's y location. |
void |
hide()
Hides the shape graphically. |
void |
paint(java.awt.Graphics2D g)
This is the methid the DrawingPanel will call when the shape needs to display itself. |
void |
setColor(java.awt.Color c)
Sets the color of the shape. |
abstract void |
setLocation(int x,
int y)
Set object's location to given coordinates. |
abstract void |
setLocation(java.awt.Point p)
Set object's location to given point. |
void |
setRotation(int degrees)
Set the rotation of the shape. |
void |
show()
Displays the shape graphically. |
| Methods inherited from class wheelsunh.users.AbstractShape |
|---|
boundsIntersects, center, distance, getCenter, getCenterX, getCenterY, getHeight, getIntersection, getWidth, intersects, intersects, setCenter |
| Methods inherited from class wheelsunh.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
wheelsunh.etc.DrawingPanel in which the shape will
be drawn.
protected java.awt.Shape _shape
java.awt.Shape that defines the look of the shape
protected java.awt.Color _c
public static final java.awt.Color DEFAULT_COLOR
| Constructor Detail |
|---|
public Shape(java.awt.Shape shape)
shape - the shape that describes our Shape
public Shape(java.awt.Shape shape,
DrawingPanel dp)
shape - the shape that describes our Shapedp - the wheelsunh.etc.DrawingPanel in which the shape will be
drawn| Method Detail |
|---|
public void hide()
public void show()
public void paint(java.awt.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(java.awt.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(java.awt.Color c)
setColor in interface Colorablepublic java.awt.Color getColor()
getColor in interface Colorablepublic void setRotation(int degrees)
setRotation in interface RotatablesetRotation in class AbstractShapedegrees - the magnitude of the rotation in degreespublic int getRotation()
getRotation in interface RotatablegetRotation in class AbstractShapepublic java.awt.Rectangle getBounds()
java.awt.Rectangle that bounds the shape.
getBounds in class AbstractShapepublic boolean contains(java.awt.Point p)
contains in interface CustomGraphicp - the point
public abstract void setLocation(int x,
int y)
setLocation in interface LocatablesetLocation in class AbstractShapepublic abstract void setLocation(java.awt.Point p)
setLocation in interface LocatablesetLocation in class AbstractShapepublic abstract java.awt.Point getLocation()
getLocation in interface LocatablegetLocation in class AbstractShapepublic abstract int getXLocation()
getXLocation in interface LocatablegetXLocation in class AbstractShapepublic abstract int getYLocation()
getYLocation in interface LocatablegetYLocation in class AbstractShape
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||