title: How to draw circle on JPanel? Java 2D
body: <p>I have a JPanel for which I set some image as the background. I need to draw a bunch of circles on top of the image. Now the circles will be positioned based on some coordinate x,y, and the size will be based on some integer size.  This is what I have as my class.</p>
  
  <pre><code>import java.awt.Dimension;
  import java.awt.Graphics;
  import java.awt.Image;
  import javax.swing.JPanel;
  
  class ImagePanel extends JPanel {
  
      private Image img;
      CircleList cList;  //added this
  
      public ImagePanel(Image img) {
          this.img = img;
          Dimension size = new Dimension(img.getWidth(null), img.getHeight(null));
          setPreferredSize(size);
          setMinimumSize(size);
          setMaximumSize(size);
          setSize(size);
          setLayout(null);
  
          cList = new CircleList(); //added this
      }
  
      public void paintComponent(Graphics g) {
          g.drawImage(img, 0, 0, null);
  
          cList.draw(null); //added this
      }
  }
  </code></pre>
  
  <p>How can I create some method that can performed this? </p>