   import java.awt.Color;

public   class Circle extends Figure {
   
      private double theRadius;  // the radius
      private boolean filled;    // filled or not
    
      public Circle(Draw canvas) {
         super(canvas);  
         theRadius = 1;  // default radius is 1
         filled = false; // default is not filled
      }
   
      public void setRadius(double radius) {
         theRadius = radius;
      }
   
      public double getArea() {
         return Math.pow(theRadius,2) * Math.PI;
      }
   	
      public double getRadius() {
         return theRadius;
      }
   
      public void setFilled() {
         filled = true;
      }
   
      public void unSetFilled() {
         filled = false;
      }
   
      public void move(double x, double y) {
      // intended for making small moves
         Color savedColor = getColor();
      
         this.setRadius(theRadius + .01);
         this.setColor(Color.WHITE);
         this.draw();
      
         this.setLocation(x,y);
         this.setRadius(theRadius - .01);
         this.setColor(savedColor);
         this.draw();
      }
   
      public void moveTo(double x, double y, int steps) {
      // smoothly move to x and y in the specified number of small steps
      //
      // this is for illustration, but may not be the most useful design
      
         double distX = Math.abs(x - theX);
         double distY = Math.abs(y - theY);
      
         double dx = // the x distance to travel in each step
            (x > theX ? distX / steps: -distX / steps);
         double dy = // the y distance to travel in each step
            (y > theY ? distY / steps: -distY / steps);
      
         for (int i = 0; i < steps; i++) {
            theCanvas.show(20);
         
            Color savedColor = getColor();
         
            this.setRadius(theRadius + .01);
            this.setColor(Color.WHITE);
            this.draw();
         
            this.setLocation(theX + dx,theY + dy);
            this.setRadius(theRadius - .01);
            this.setColor(savedColor);
            this.draw();
         }
      }
   
      public void draw() {
         super.draw();  // correctly set the pen color
      
         if (filled)
            theCanvas.filledCircle(theX, theY, theRadius);
         else
            theCanvas.circle(theX, theY, theRadius);
      }
   }


