title: adding a drawn circles Objects to an Arraylist
body: <p>I created an Arraylist of objects (Circles). I added a mouseclick event and so once I click in the panel, a circle will be drown and stored in the arraylist. I am stuck and can't think of a way around my code... I would appreciate some hints that could help me solving my problem. </p>
  
  <pre><code>import javax.swing.*;
  import javax.swing.event.*;
  import java.awt.*;
  import java.awt.event.*;
  import java.util.ArrayList;
  
  
  public class Circle extends JFrame
  {
  
      private JPanel panel;
      private  ArrayList &lt;Circle&gt; circle;
  
      public static void main(String[]args)
  
          {
  
          setTitle("Drawing Circles");
          // Set the size of the window.
          setSize(WINDOW_WIDTH, WINDOW_HEIGHT);
          // Specify an action for the close button.
          setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          // set the Frame's layout
          setLayout(new BorderLayout());
          // Add the panels to the frame's content pane.
          add(panel, BorderLayout.CENTER);
          // Display the window.
          setVisible(true);
  
          circle = new ArrayList&lt;Circle&gt;();
          }
  
      public Circle()
          {
          panel.addMouseListener(new ClickingLitener());
          }
  
  
  
  
      private class ClickingLitener implements MouseListener
      {
  
          public void mouseClicked(MouseEvent e)
              {
              circle.add(new Circle());
  
              // somehow I need to call panel.paintComponent ... right ?
              }
      }
  
  }
  </code></pre>