This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android forum!
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: 19654
    
  18

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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Rotating image in JLabel
 
Similar Threads
Formatted text display.
Rotating image in JLabel
rotate image java2d
Issues with Jar Files and loading images
Image -> BufferedImage