aspose file tools*
The moose likes Beginning Java and the fly likes Rotating image in JLabel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic
Author

Rotating image in JLabel

Adam Cripps
Ranch Hand

Joined: Oct 01, 2011
Posts: 41

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

Joined: Oct 27, 2005
Posts: 19760
    
  20

Recreated here. Since that's a better forum for it I'm closing this one.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Rotating image in JLabel