|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object fishbowl.MovingBodyAdapter
public abstract class MovingBodyAdapter
Normal users can ignore this class. A class that implements many of the methods of MovingBody by delegating the work to Shape objects. This class is only made available for those wishing to create new type of MovingBody classes. Created: Sat Jan 31 14:56:17 2004
Field Summary | |
---|---|
protected Shape |
_delegate
The Shape object to delegate calls to. |
protected Vector |
_vector
Vector used for motion. |
Constructor Summary | |
---|---|
MovingBodyAdapter(Shape delegate)
Creates a new MovingBodyAdapter instance. |
|
MovingBodyAdapter(Shape delegate,
int x_low,
int x_high,
int y_low,
int y_high)
|
Method Summary | |
---|---|
boolean |
contains(Point param1)
Delegated to the shape. |
Rectangle |
getBounds()
Delegated to the shape. |
Point |
getCenterLocation()
Delegated to the shape. |
Color |
getColor()
Delegated to the shape. |
Dimension |
getDimension()
Delegated to the shape. |
Integer |
getDx()
Get the change in x. |
Integer |
getDy()
Get the change in y. |
Point |
getLocation()
Delegated to the shape. |
Integer |
getRotation()
Delegated to the shape. |
Vector |
getVector()
Returns the motion vector for this MovingBody |
void |
hide()
Delegated to the shape. |
boolean |
intersects(Graphic param1)
Delegated to the shape. |
void |
mouseClicked(MouseEvent param1)
Delegated to the shape. |
void |
mouseDragged(MouseEvent param1)
Delegated to the shape. |
void |
mouseEntered(MouseEvent param1)
Delegated to the shape. |
void |
mouseExited(MouseEvent param1)
Delegated to the shape. |
void |
mouseMoved(MouseEvent param1)
Delegated to the shape. |
void |
mousePressed(MouseEvent param1)
Delegated to the shape. |
void |
mouseReleased(MouseEvent param1)
Delegated to the shape. |
void |
paint(Graphics2D param1)
Delegated to the shape. |
void |
react()
|
void |
setColor(Color param1)
Delegated to the shape. |
void |
setDimension(Dimension param1)
Delegated to the shape. |
void |
setFrameDelay(int milliseconds)
Sets the delay in milliseconds between calls to move(). |
void |
setLocation(Point param1)
Delegated to the shape. |
void |
setRotation(int param1)
Delegated to the shape. |
void |
setVector(Vector newVector)
Change the vector motion of this MovingBody |
void |
show()
Delegated to the shape. |
void |
startBouncing()
Start (global) bouncing behavior. |
void |
stopBouncing()
Stop (global) bouncing behavior. |
void |
update()
Update the position of the ball based on the velocity, if the ball hits a wall, reverses velocity in the appropriate direction. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface cse115.graphics.Graphic |
---|
actualPaint, addMouseListener, addMouseMotionListener, getMouseListeners, getMouseMotionListeners, getShape, setContainer |
Methods inherited from interface cse115.graphics.CenterLocatable |
---|
setCenterLocation |
Methods inherited from interface cse115.graphics.Locatable |
---|
move |
Methods inherited from interface cse115.graphics.Rotatable |
---|
rotate, setRotation |
Field Detail |
---|
protected Vector _vector
protected Shape _delegate
Constructor Detail |
---|
public MovingBodyAdapter(Shape delegate)
MovingBodyAdapter
instance.
delegate
- the shape that does the work.public MovingBodyAdapter(Shape delegate, int x_low, int x_high, int y_low, int y_high)
Method Detail |
---|
public void update()
update
in interface MovingBody
public Integer getDx()
public Integer getDy()
public void setFrameDelay(int milliseconds)
milliseconds
- the delay in milliseconds.public void startBouncing()
public void stopBouncing()
public boolean contains(Point param1)
contains
in interface Graphic
param1
- The point to check
p
false if notNGP.Graphic#contains(Point)
public boolean intersects(Graphic param1)
intersects
in interface Graphic
param1
- the graphic to test for intersection
NGP.Graphic#intersects(Graphic)
public void paint(Graphics2D param1)
paint
in interface Graphic
param1
- The Graphics2D object used to do the paintingNGP.Graphic#paint(Graphics2D)
public void hide()
NGP.Graphic#hide()
public void show()
NGP.Graphic#show()
public Rectangle getBounds()
getBounds
in interface Graphic
NGP.Graphic#getBounds()
public Point getCenterLocation()
getCenterLocation
in interface CenterLocatable
NGP.Graphic#getCenterLocation()
public void setColor(Color param1)
setColor
in interface Colorable
param1
- the java.awt.Color
to set the Object to becomeNGP.Colorable#setColor(Color)
public Color getColor()
getColor
in interface Colorable
java.awt.Color
of this ObjectNGP.Colorable#getColor()
public void mouseDragged(MouseEvent param1)
MouseMotionListener.mouseDragged(MouseEvent)
public void mouseMoved(MouseEvent param1)
MouseMotionListener.mouseMoved(MouseEvent)
public void mouseClicked(MouseEvent param1)
MouseListener.mouseClicked(MouseEvent)
public void mouseEntered(MouseEvent param1)
MouseListener.mouseEntered(MouseEvent)
public void mouseExited(MouseEvent param1)
MouseListener.mouseExited(MouseEvent)
public void mousePressed(MouseEvent param1)
MouseListener.mousePressed(MouseEvent)
public void mouseReleased(MouseEvent param1)
MouseListener.mouseReleased(MouseEvent)
public void setDimension(Dimension param1)
setDimension
in interface Sizeable
param1
- The dimension to set the Object to beNGP.Sizeable#setDimension(Dimension)
public Dimension getDimension()
getDimension
in interface Sizeable
NGP.Sizeable#getDimension()
public Point getLocation()
getLocation
in interface Locatable
NGP.Locatable#getLocation()
public void setLocation(Point param1)
setLocation
in interface Locatable
param1
- the point at which to locate this ObjectNGP.Locatable#setLocation(Point)
public void setRotation(int param1)
NGP.Rotatable#setRotation(int)
public Integer getRotation()
getRotation
in interface Rotatable
NGP.Rotatable#getRotation()
public void setVector(Vector newVector)
setVector
in interface MovingBody
newVector
- The new vector motion for this shape.public Vector getVector()
getVector
in interface MovingBody
public void react()
NGP.Reactor#react()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |