import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.Ellipse2D;
import javax.swing.JPanel;
import javax.swing.JComponent;

/**
   A component that draws two circles.
*/
public class TwoCircleComponent extends JComponent
{  
   /**
      Constructs the component so that it draws two given circles.
      @param c1 the first circle
      @param c2 the second circle
    */
   public TwoCircleComponent(Ellipse2D.Double c1, Ellipse2D.Double c2)
   {
      circle1 = c1;
      circle2 = c2;
   }

   public void paintComponent(Graphics g)
   {  
      // Recover Graphics2D
      Graphics2D g2 = (Graphics2D) g;

      g2.draw(circle1);
      g2.draw(circle2);
   }

   private Ellipse2D.Double circle1;
   private Ellipse2D.Double circle2;
}
