Bookmark Topic Watch Topic
  • New Topic

Rotating image in JLabel

 
Adam Cripps
Ranch Hand
Posts: 41
Eclipse IDE Linux Ubuntu
  • Mark post as helpful
  • send pies
  • Report post to moderator
I have a simple application that I want to distribute to colleagues. However, I'm having a few problems.

The app loaded an image in to an IconImage and displayed it in a JLabel. However, it seems to me that the IconImage isn't that great for rotating. So, I started looking at BufferedImage and then loading that into something like a Graphics object. However, I'm getting stuck with the concepts of casting between these objects and wouldn't mind if someone could point me in the right direction for the most efficient way of doing it (which objects to load the image file in to and then how to cast it in to a JLabel friendly object).

I have a lot of code - not sure if it's useful here, so I've pasted it in to a paste bin for brevity. At the moment, this is throwing errors to do with a BufferedImage being passed to a setPane method which only accepts an Image object. You don't have to correct my code, but just point me in the right direction of what objects to load it into and how to cast them - thanks.

OpenImage.java - http://pastebin.com/gffZyTPv
OpenImagePanel.java - http://pastebin.com/XNbMS9P1

Thanks
Adam

ps. this looks like a cool forum.
 
Rob Spoor
Sheriff
Pie
Posts: 20546
56
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Report post to moderator
Recreated here. Since that's a better forum for it I'm closing this one.
 
    Bookmark Topic Watch Topic
  • New Topic