001 // Ball.java 002 // Created: Wednesday, September 22, 1999 9:52:48 PM 003 004 package ballworld; 005 006 /** 007 * The Ball interface describes methods that a Ball presents to other objects. 008 * Classes that you define will implement Ball by defining the methods that are 009 * declared here. 010 * 011 * @author (previous author unknown) 012 * @author Patrick G. Heck, gus.heck@olin.edu 013 * @version $Id: Ball.java,v 1.2 2003/09/11 21:35:37 gus Exp $ 014 */ 015 public interface Ball 016 { 017 /** Returns the current horizontal location of the Ball 018 * @return The horizontal location 019 */ 020 public double getX(); 021 022 /** Returns the current vertical location of the Ball 023 * @return The vertical location 024 */ 025 public double getY(); 026 027 /** Returns the current radius of the Ball 028 * @return The radius 029 */ 030 public double getRadius(); 031 032 /** This method will be called by our setup code shortly after your Ball is created. 033 * If you would like to use the World object to get information about the world, 034 * then you should store the parameter of this method somewhere safe. 035 * @param theWorld A world object that contains this ball 036 */ 037 public void setWorld(World theWorld); 038 039 /** 040 * Process a click from the mouse. This method is called if the user selects 041 * this particular ball and then clicks or drags the mouse somewhere. 042 * The atX and atY parameters are the location that the user released 043 * the mouse button. 044 * 045 * @param atX The x coordinate of the user's click 046 * @param atY The y coordinate of the user's click 047 */ 048 public void userClicked(double atX, double atY); 049 050 /** This method is called if the user selects this particualr ball and then types a 051 * key. The key that the user typed is passed as the parameter. Note that not 052 * all keys on the keyboard will cause this method to get called -- only those keys 053 * that have a printable form. (For instance, the 'J' or space key will trigger this 054 * method, but the arrow and function keys may not.) 055 * @param key The character from the key that the user typed. 056 */ 057 public void userTyped(char key); 058 } 059 060 /* 061 * $Log: Ball.java,v $ 062 * Revision 1.2 2003/09/11 21:35:37 gus 063 * change package name 064 * 065 * Revision 1.1 2003/02/10 14:50:16 gus 066 * A complete rewrite of the old ballworld. 067 * 068 */