title: Java Graphics and Image explanation?
body: <p>I've recently started doing some tutorials in simple game making stuff.</p>
  
  <p>so far it's been pretty basic stuff I can wrap my head around or already understood.
  However I've just done a tutorial on double buffering - <a href="http://youtu.be/4T3WJEH7zrc" rel="nofollow">http://youtu.be/4T3WJEH7zrc</a></p>
  
  <p>Anyway, the piece of code i'm having trouble understanding is this:</p>
  
  <pre><code>public void paint(Graphics g) {
      dbImage = createImage(getWidth(), getHeight());     
      dbg = dbImage.getGraphics();                        
      paintComponent(dbg);                                
      g.drawImage(dbImage, 0, 0, this);                   
  }
  
  public void paintComponent (Graphics g) {           
      g.fillOval(x, y, 15, 15);                       
      repaint();                                      
  }
  </code></pre>
  
  <p>So you create an image of the window, and then a graphic of that image (not too sure what the difference is there and couldn't find a simple enough definition to be satisfied with).
  you then pass the image into the 2nd method which creates an oval and then the window is updated via repaint (i'm pretty sure). Then finally, back in paint, the image is drawn.</p>
  
  <p>So if someone could explain the flow of info to me and the difference between a graphic vs an image and the repaint command I'd be super thankful - cheers!</p>