title: Clear button for my canvas in JPanel when drawing shapes
body: <p>I am drawing shapes and the shapes store into an arraylist.
  When I hit clear, all the shapes clear out of the arraylist except for the last one I have drawn. </p>
  
  <p>I even did </p>
  
  <pre><code>Arraylist list = new Arraylist();
  list.clear();
  JOptionPane.showMessageDialog(null, "Size is: " + list.size());
  </code></pre>
  
  <p>just to prove the size was 0 and a similar test to make sure the last added object was added into the array list. What could be the possible reasons for this?</p>