Two Laptop Bag
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

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic

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. - -


ps. this looks like a cool forum.
Rob Spoor

Joined: Oct 27, 2005
Posts: 20279

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

How To Ask Questions How To Answer Questions
I agree. Here's the link:
subject: Rotating image in JLabel
It's not a secret anymore!