demos.bounce
Class BouncingBall
java.lang.Object
  
graphics.AbstractGraphic
      
graphics.AbstractColorableGraphic
          
graphics.Ellipse
              
demos.bounce.BouncingBall
- All Implemented Interfaces: 
 - CenterLocatable, IColorable, IColorableGraphic, IGraphic, ILocatable, IRotatable, ISizeable
 
public class BouncingBall
- extends Ellipse
 
| 
Constructor Summary | 
BouncingBall()
 
          Creates a new instance of BetterBouncingBouncyShape | 
 
| 
Method Summary | 
 java.lang.Integer | 
getSpeed()
 
          Returns the speed of the movement. | 
 void | 
setColor(Color newColor)
 
            | 
 void | 
setDimension(java.awt.Dimension newDimension)
 
          Changes the Dimension of this Graphic | 
 void | 
setSpeed(java.lang.Integer newSpeed)
 
          Sets the speed of the movement. | 
 void | 
startBouncing()
 
          Method to be called when the user wants the BouncyShape to start bouncing. | 
 void | 
stopBouncing()
 
          Method to be called when user wants the BouncyShape to stop bouncing. | 
 
 
 
| Methods inherited from class graphics.AbstractGraphic | 
addMouseListener, addMouseMotionListener, contains, getBounds, getCenterLocation, getContainer, getDimension, getLocation, getMouseListeners, getMouseMotionListeners, getMovement, getRotation, intersects, move, rotate, setCenterLocation, setContainer, setLocation, setMovement, setRotation | 
 
| Methods inherited from class java.lang.Object | 
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
 
| Methods inherited from interface graphics.IGraphic | 
addMouseListener, addMouseMotionListener, contains, getBounds, getContainer, getMouseListeners, getMouseMotionListeners, getMovement, intersects, setContainer, setMovement | 
 
 
 
 
 
BouncingBall
public BouncingBall()
- Creates a new instance of BetterBouncingBouncyShape
 
stopBouncing
public void stopBouncing()
- Method to be called when user wants the BouncyShape to stop bouncing.
 
 
startBouncing
public void startBouncing()
- Method to be called when the user wants the BouncyShape to start bouncing.
 
 
setSpeed
public void setSpeed(java.lang.Integer newSpeed)
- Sets the speed of the movement.  Note that the speed will be set to the
 same value in both the x and y direction.
- Parameters:
 newSpeed - A number that represents how far in pixels the movement
 should be each time.
 
 
getSpeed
public java.lang.Integer getSpeed()
- Returns the speed of the movement.  Since the speed is always set to be
 the same in the x and y direction, this value applies to speed in both
 directions.
- Returns:
 - A number that represents how far in pixels the movement is currently
 set to.
 
 
 
setDimension
public void setDimension(java.awt.Dimension newDimension)
- Description copied from class: 
AbstractGraphic 
- Changes the Dimension of this Graphic
- Specified by:
 setDimension in interface ISizeable- Overrides:
 setDimension in class AbstractGraphic
 
- Parameters:
 newDimension - - See Also:
 AbstractGraphic.setDimension(java.awt.Dimension)
 
 
setColor
public void setColor(Color newColor)
- Parameters:
 newColor - - See Also:
 AbstractColorableGraphic.setColor(java.awt.Color)