// Raja Sooriamurthi 11/13/99 import java.awt.*; public class Ball { final static int DEFAULT_RADIUS = 8; Point position; Color color; int radius; Ball (Color c, int r, Point p) { color = c; radius = r; position = p; } Ball (Point p) { this (Util.randColor(), DEFAULT_RADIUS, p); } Ball (Component cmp) { this (Util.randPoint(cmp)); } // public int getX() {return (int)(position.getX());} // public int getY() {return (int)(position.getY());} // Java 1.1 doesn't understand getX public int getX() {return (int)(position.x);} public int getY() {return (int)(position.y);} public void paint (Graphics g) { g.setColor(color); g.fillOval (getX()-radius, getY()-radius, 2*radius, 2*radius); } }