title: Java arraylist of graphics
body: <p>How can I store an ArrayList of graphics so that I can then call a drawString() command on a specific ArrayList position?</p>
  
  <p>For example this is what I want but none of the code works :(</p>
  
  <pre><code>ArrayList&lt;Graphics&gt; list= new ArrayList&lt;Graphics&gt;();
  //create a certain number of graphics
  for (int i = 0; i &lt; 5; i++) {
       list.add(new Graphics[i] = null);
  }
  //run drawString on a certain array value independently of the others
  ((Graphics) columns.get(2)).drawString("v", 50, 50);
  ((Graphics) columns.get(4)).drawString("xx", 10, 100);
  </code></pre>