title: Java rotate an image in the center
body: <p>How do i rotate an image in the center if itself?
  this code works, but it rotates the image in the top-left corner of the screen:</p>
  
  <pre><code>    AffineTransform oldtrans = new AffineTransform();
      AffineTransform trans = new AffineTransform();
  
      trans.setToIdentity();
      trans.rotate(Math.toRadians(angle));
      trans.translate(_x-(width/2), _y-(height/2));
      g.setTransform(trans);
      g.drawImage(this.getImage(), (int)_x, (int)_y, (int)width, (int)height, null);
      trans.setToIdentity();
      g.setTransform(oldtrans);
  </code></pre>
  
  <p>Please help!!!</p>