package graphics; import java.awt.*; public class Circle extends Graphic implements Draggable { public int myX, myY; // x and y coordinates of circle center public int myRadius; // Circle radius public Color myColor; // Circle color public Circle(int x, int y, int r, Color circleColor) { myX = x; myY = y; myRadius = r; myColor = circleColor; } // Have the Circle object draw itself on the page passed as a parameter. public void draw(Graphics page) { // Set the color. page.setColor(myColor); // Draw the circle. page.drawOval(myX - myRadius, myY - myRadius, 2*myRadius, 2*myRadius); } // Have the Circle object move itself by deltaX, deltaY. public void move(int deltaX, int deltaY) { myX += deltaX; myY += deltaY; } // Have the Circle object return its area. public double areaOf() { return Math.PI * myRadius * myRadius; } }