title: Drawing an image with Graphics2D
body: <p>I am trying to create a game using JFrame, and it requires that I draw images. I am using graphics2D to paint them, but I couldn't figure out why this gave me no output:</p>
  
  <pre><code>public void paint(Graphics g) {
      Graphics2D g2d = (Graphics2D) g;
      g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
              RenderingHints.VALUE_ANTIALIAS_ON);     
      Image img = Toolkit.getDefaultToolkit().getImage("src/resources/main/my_image");
      g2d.drawImage(img, 0, 0, null);
      g2d.finalize();
  }
  </code></pre>
  
  <p>And I haven't been able to find a way to draw an image that actually works.</p>