import objectdraw.*; import java.awt.Color; public class Basketball { private static final Color BALL_ORANGE = new Color(250, 85, 10); // the interior of the ball private FilledOval body; // the black frame around the ball private FramedOval border; public Basketball(int xpos, int ypos, int diameter, DrawingCanvas theCanvas) { body = new FilledOval(xpos, ypos, diameter, diameter, theCanvas); border = new FramedOval(xpos, ypos, diameter, diameter, theCanvas); body.setColor(BALL_ORANGE); } public void move(double xdist, double ydist) { body.move(xdist, ydist); border.move(xdist, ydist); } public void moveTo(double xpos, double ypos) { body.moveTo(xpos, ypos); border.moveTo(xpos, ypos); } public boolean contains(Location point) { return body.contains(point); } public double getX() { return body.getX(); } public double getY() { return body.getY(); } public Location getCenter() { return new Location(body.getX() + body.getWidth() / 2, body.getY() + body.getHeight() / 2); } public void setColor(Color newColor) { body.setColor(newColor); } }