|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectCSE115.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 |
|---|
| Fields inherited from interface NGP.Colorable |
|---|
DEFAULT_GRAY |
| 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. |
DrawingPanel |
getDrawingPanel()
Delegated to the shape. |
Integer |
getDx()
Get the change in x. |
Integer |
getDy()
Get the change in y. |
Point |
getLocation()
Delegated to the shape. |
int |
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()
Called when a Reactor decides that it was
clicked on. |
void |
setColor(Color param1)
Delegated to the shape. |
void |
setDimension(Dimension param1)
Delegated to the shape. |
void |
setDrawingPanel(DrawingPanel 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 |
setVelocity(Integer dx,
Integer dy)
Sets the velocity, in the x and y directions of the ball. |
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 |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 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 void setVelocity(Integer dx,
Integer dy)
setVelocity in interface MovingBodydx - the new change in x value.dy - the new change in y value.public Integer getDx()
getDx in interface MovingBodypublic Integer getDy()
getDy in interface MovingBodypublic void setFrameDelay(int milliseconds)
milliseconds - the delay in milliseconds.public void startBouncing()
public void stopBouncing()
public boolean contains(Point param1)
contains in interface Graphicparam1 - the Point to check for containment
true if the Point is contained,
false otherwiseGraphic.contains(Point)public boolean intersects(Graphic param1)
intersects in interface Graphictrue if it does intersect, false
if notGraphic.intersects(Graphic)public void paint(Graphics2D param1)
paint in interface Graphicparam1 - the Graphics2D to use when paintingGraphic.paint(Graphics2D)public void hide()
hide in interface GraphicGraphic.hide()public void show()
show in interface GraphicGraphic.show()public void setDrawingPanel(DrawingPanel param1)
setDrawingPanel in interface Graphicparam1 - the DrawingPanel to useGraphic.setDrawingPanel(DrawingPanel)public DrawingPanel getDrawingPanel()
getDrawingPanel in interface GraphicGraphic's DrawingPanelGraphic.getDrawingPanel()public Rectangle getBounds()
getBounds in interface GraphicGraphic.getBounds()public Point getCenterLocation()
getCenterLocation in interface GraphicGraphic.getCenterLocation()public void setColor(Color param1)
setColor in interface Colorableparam1 - the color to set the ColorableColorable.setColor(Color)public Color getColor()
getColor in interface ColorableColorableColorable.getColor()public void mouseDragged(MouseEvent param1)
mouseDragged in interface MouseMotionListenerMouseMotionListener.mouseDragged(MouseEvent)public void mouseMoved(MouseEvent param1)
mouseMoved in interface MouseMotionListenerMouseMotionListener.mouseMoved(MouseEvent)public void mouseClicked(MouseEvent param1)
mouseClicked in interface MouseListenerMouseListener.mouseClicked(MouseEvent)public void mouseEntered(MouseEvent param1)
mouseEntered in interface MouseListenerMouseListener.mouseEntered(MouseEvent)public void mouseExited(MouseEvent param1)
mouseExited in interface MouseListenerMouseListener.mouseExited(MouseEvent)public void mousePressed(MouseEvent param1)
mousePressed in interface MouseListenerMouseListener.mousePressed(MouseEvent)public void mouseReleased(MouseEvent param1)
mouseReleased in interface MouseListenerMouseListener.mouseReleased(MouseEvent)public void setDimension(Dimension param1)
setDimension in interface Sizeableparam1 - the user-preferred Dimension of this
SizeableSizeable.setDimension(Dimension)public Dimension getDimension()
getDimension in interface SizeableDimension of this SizeableSizeable.getDimension()public Point getLocation()
getLocation in interface LocatablePoint for this LocatableLocatable.getLocation()public void setLocation(Point param1)
setLocation in interface Locatableparam1 - the new Point for this LocatableLocatable.setLocation(Point)public void setRotation(int param1)
setRotation in interface Rotatableparam1 - the number of degrees this Rotatable should
rotateRotatable.setRotation(int)public int getRotation()
getRotation in interface RotatableRotatable is rotatedRotatable.getRotation()public void setVector(Vector newVector)
setVector in interface MovingBodynewVector - The new vector motion for this shape.public Vector getVector()
getVector in interface MovingBodypublic void react()
NGP.ReactorReactor decides that it was
clicked on.
react in interface ReactorReactor.react()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||