Ball World Problem Set Javadocs

ballworld
Interface Ball

All Known Implementing Classes:
Exploder, Faller, Shrinker, Throbber

public interface Ball

The Ball interface describes methods that a Ball presents to other objects. Classes that you define will implement Ball by defining the methods that are declared here.

Version:
$Id: Ball.java,v 1.2 2003/09/11 21:35:37 gus Exp $
Author:
(previous author unknown), Patrick G. Heck, gus.heck@olin.edu

Method Summary
 double getRadius()
          Returns the current radius of the Ball
 double getX()
          Returns the current horizontal location of the Ball
 double getY()
          Returns the current vertical location of the Ball
 void setWorld(World theWorld)
          This method will be called by our setup code shortly after your Ball is created.
 void userClicked(double atX, double atY)
          Process a click from the mouse.
 void userTyped(char key)
          This method is called if the user selects this particualr ball and then types a key.
 

Method Detail

getX

public double getX()
Returns the current horizontal location of the Ball

Returns:
The horizontal location

getY

public double getY()
Returns the current vertical location of the Ball

Returns:
The vertical location

getRadius

public double getRadius()
Returns the current radius of the Ball

Returns:
The radius

setWorld

public void setWorld(World theWorld)
This method will be called by our setup code shortly after your Ball is created. If you would like to use the World object to get information about the world, then you should store the parameter of this method somewhere safe.

Parameters:
theWorld - A world object that contains this ball

userClicked

public void userClicked(double atX,
                        double atY)
Process a click from the mouse. This method is called if the user selects this particular ball and then clicks or drags the mouse somewhere. The atX and atY parameters are the location that the user released the mouse button.

Parameters:
atX - The x coordinate of the user's click
atY - The y coordinate of the user's click

userTyped

public void userTyped(char key)
This method is called if the user selects this particualr ball and then types a key. The key that the user typed is passed as the parameter. Note that not all keys on the keyboard will cause this method to get called -- only those keys that have a printable form. (For instance, the 'J' or space key will trigger this method, but the arrow and function keys may not.)

Parameters:
key - The character from the key that the user typed.

Ball World Problem Set Javadocs