How to rotate an image properly in JPanel (Java)

Posted by Bruce on Stack Overflow See other posts from Stack Overflow or by Bruce
Published on 2010-03-26T19:57:37Z Indexed on 2010/03/26 20:33 UTC
Read the original article Hit count: 246

Filed under:
|
|
|

Hi guys, I'm working on rotating a loaded image. I set the graphics on a JPanel and then use standard AffineTransform in order to rotate it, say, 45 degrees. Unfortunately, the image is being cut, if it exceeds the panel area. How may I force JPanel to add scrolls to itself (while loading an image file, I would like to adjust the size of JPanel by adding the scrolls, without adjusting the size of JFrame).

Or, in other words, how to correctly rotate the whole image?

Thank you in advance for the reply!

© Stack Overflow or respective owner

Related posts about java

Related posts about jpanel