title: paintComponent through list of objects
body: <p>How would I iterate through a list of objects to paint their <code>draw()</code> methods? If I have it set up correctly how do I implement this correctly?</p>
  
  <p>Class I'd like to draw onto:</p>
  
  <pre><code>public class Window extends JPanel implements IObserver, ActionListener{
      private Timer timer = new Timer(5, this);
      public Window(){
          super.setBorder(BorderFactory.createTitledBorder("Window:"));
          timer.start();
      }
      public void update(IObservable o, Object arg){
          GameWorldProxy gwp = (GameWorldProxy) o;
          Iterator gameObjects = gwp.getCollection().getIterator();
          while(gameObjects.hasNext()){
              GameObject gameObj = (GameObject) gameObjects.getNext();
              System.out.println(gameObj);
          }
      }
  
      public void paintComponent(Graphics g){
          super.paintComponent(g);
      }
      public void actionPerformed(ActionEvent e){
          repaint();
      }
  }
  </code></pre>
  
  <p>Car class:</p>
  
  <pre><code>public class Car extends MoveableObject implements ISteerable, IDrawable{
      public void draw(Graphics g, int x, int y) {
          g.setColor(Color.RED);
          g.fillRect(x, y, 25, 10);
      }
  
  }
  </code></pre>
  
  <p>So for example, I have a few different classes other than the <code>Car</code> class. It has a <code>draw()</code> method in there and the <code>GameObject</code> class extends from <code>Car</code> From my understanding I should also have a <code>draw()</code> method in <code>GameObject</code>. Say there's 2 listing of <code>Cars</code> under the <code>gameObj</code>, how would I draw them both? I'm not sure I quite understand how to iterate through the list to draw it on the panel.</p>