0

This seems like an easy task, but I've literally searched for hours and haven't found anything so far. I have an ImageIcon which I would like to rotate by a certain angle.

What would be the simplest way to do this?

Edit: I tried converting the ImageIcon to a BufferedImage, and rotating the Graphics2`bPlayerImage = new BufferedImage( playerSize, playerSize, BufferedImage.TYPE_INT_RGB);

    Graphics2D g = (Graphics2D)bPlayerImage.getGraphics();
    g.rotate(Math.toRadians(turnAngle));
    g.drawImage(playerImage, x, y, null);`

The image doesn't appear to rotate.

Rayexar
  • 33
  • 1
  • 5
  • 2
    See [Rotate JLabel or ImageIcon on Java Swing](http://stackoverflow.com/questions/4287499/rotate-jlabel-or-imageicon-on-java-swing) – Reimeus Jun 08 '13 at 10:53
  • 1
    `" I've literally searched for hours and haven't found anything so far..."` -- I suggest that you keep on searching. Image rotation is a pretty common question here. I'll bet with a little more searching you'll find much useful information and code examples. – Hovercraft Full Of Eels Jun 08 '13 at 11:46
  • See also this related [example](http://stackoverflow.com/a/3420651/230513). – trashgod Jun 08 '13 at 12:06
  • _suggest that you keep on searching._ or post an [SSCCE](http://sscce.org) – Guillaume Polet Jun 08 '13 at 15:14

0 Answers0