|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--CSE115.BallWorld.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. |
|
| 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. |
int |
getDx()
Get the change in x. |
int |
getDy()
Get the change in y. |
Point |
getLocation()
Delegated to the shape. |
int |
getRotation()
Delegated to the shape. |
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 |
setBackgroundColor(Color color)
Set the color of the background. |
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 |
setVelocity(int dx,
int 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 |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public MovingBodyAdapter(Shape delegate)
MovingBodyAdapter instance.
delegate - the shape that does the work.| Method Detail |
public void update()
update in interface MovingBody
public void setVelocity(int dx,
int dy)
setVelocity in interface MovingBodydx - the new change in x value.dy - the new change in y value.public int getDx()
getDx in interface MovingBodypublic int getDy()
getDy in interface MovingBodypublic void setFrameDelay(int milliseconds)
milliseconds - the delay in milliseconds.public void startBouncing()
public void stopBouncing()
public void setBackgroundColor(Color color)
color - the new background color.public boolean contains(Point param1)
contains in interface GraphicGraphic.contains(Point)public boolean intersects(Graphic param1)
intersects in interface GraphicGraphic.intersects(Graphic)public void paint(Graphics2D param1)
paint in interface GraphicGraphic.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 GraphicGraphic.setDrawingPanel(DrawingPanel)public DrawingPanel getDrawingPanel()
getDrawingPanel in interface GraphicGraphic.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 ColorableColorable.setColor(Color)public Color getColor()
getColor in interface ColorableColorable.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 SizeableSizeable.setDimension(Dimension)public Dimension getDimension()
getDimension in interface SizeableSizeable.getDimension()public Point getLocation()
getLocation in interface LocatableLocatable.getLocation()public void setLocation(Point param1)
setLocation in interface LocatableLocatable.setLocation(Point)public void setRotation(int param1)
setRotation in interface RotatableRotatable.setRotation(int)public int getRotation()
getRotation in interface RotatableRotatable.getRotation()public void react()
react in interface ReactorReactor.react()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||