title: Rotating BufferedImage instances
body: <p>I am having trouble getting a rotated <code>BufferedImage</code> to display. I think the rotation is working just fine, but I can't actually draw it to the screen. My code:</p>
  
  <pre><code>Class extends JPanel {
      BufferedImage img;
      int rotation = 0;
  
      public void paintComponent(Graphics g) {
          g.clearRect(0, 0, getWidth(), getHeight());
          img2d = img.createGraphics();
          img2d.rotate(Math.toRadians(rotation), img.getWidth() / 2, img.getHeight() / 2);
          g.drawImage(img, imgx, imgy, null);
          this.repaint();
      }
  }
  </code></pre>
  
  <p>This is not working for me. I could not find any way to draw the rotated <code>img2d</code> onto <code>g</code>.</p>
  
  <p>EDIT: I have multiple objects that are being drawn onto <code>g</code>, so I can't rotate that. I need to be able to rotate things individually.</p>