|
||||||||||
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 MovingBody
dx
- the new change in x value.dy
- the new change in y value.public int getDx()
getDx
in interface MovingBody
public int getDy()
getDy
in interface MovingBody
public 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 Graphic
Graphic.contains(Point)
public boolean intersects(Graphic param1)
intersects
in interface Graphic
Graphic.intersects(Graphic)
public void paint(Graphics2D param1)
paint
in interface Graphic
Graphic.paint(Graphics2D)
public void hide()
hide
in interface Graphic
Graphic.hide()
public void show()
show
in interface Graphic
Graphic.show()
public void setDrawingPanel(DrawingPanel param1)
setDrawingPanel
in interface Graphic
Graphic.setDrawingPanel(DrawingPanel)
public DrawingPanel getDrawingPanel()
getDrawingPanel
in interface Graphic
Graphic.getDrawingPanel()
public Rectangle getBounds()
getBounds
in interface Graphic
Graphic.getBounds()
public Point getCenterLocation()
getCenterLocation
in interface Graphic
Graphic.getCenterLocation()
public void setColor(Color param1)
setColor
in interface Colorable
Colorable.setColor(Color)
public Color getColor()
getColor
in interface Colorable
Colorable.getColor()
public void mouseDragged(MouseEvent param1)
mouseDragged
in interface MouseMotionListener
MouseMotionListener.mouseDragged(MouseEvent)
public void mouseMoved(MouseEvent param1)
mouseMoved
in interface MouseMotionListener
MouseMotionListener.mouseMoved(MouseEvent)
public void mouseClicked(MouseEvent param1)
mouseClicked
in interface MouseListener
MouseListener.mouseClicked(MouseEvent)
public void mouseEntered(MouseEvent param1)
mouseEntered
in interface MouseListener
MouseListener.mouseEntered(MouseEvent)
public void mouseExited(MouseEvent param1)
mouseExited
in interface MouseListener
MouseListener.mouseExited(MouseEvent)
public void mousePressed(MouseEvent param1)
mousePressed
in interface MouseListener
MouseListener.mousePressed(MouseEvent)
public void mouseReleased(MouseEvent param1)
mouseReleased
in interface MouseListener
MouseListener.mouseReleased(MouseEvent)
public void setDimension(Dimension param1)
setDimension
in interface Sizeable
Sizeable.setDimension(Dimension)
public Dimension getDimension()
getDimension
in interface Sizeable
Sizeable.getDimension()
public Point getLocation()
getLocation
in interface Locatable
Locatable.getLocation()
public void setLocation(Point param1)
setLocation
in interface Locatable
Locatable.setLocation(Point)
public void setRotation(int param1)
setRotation
in interface Rotatable
Rotatable.setRotation(int)
public int getRotation()
getRotation
in interface Rotatable
Rotatable.getRotation()
public void react()
react
in interface Reactor
Reactor.react()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |