I am just wondering how to rotate a rectangle image with paintComponent() method of JLabel component and set its new width and height correctly?
I tried to rotate (see attached image) and the image scale becomes bigger but the JLabel scale keeps the same what makes image be out of JLabel bounds or something :S So my question is how to set image new width and height to component dynamically in a more optimal way?

OK I tried the sample David Kroukamp showed me. Thanks, David, you pointed me to right direction. I think it is a really good snippet to lean back on.
David Kroukamp’s result image preview
I tested the snippet and the result image + its component’s scale were really dynamic changed.
But the result component width I’ve got has been always a little bit wider than it’s inner image was :S
For example here is my version of an image rotated in 45 degrees angle
… As I could find (on blue background) its width is not totally fit to surround white image … Actually I was looking for some kind of standard Java Image Processing rotate solution but I couldn’t find it 🙁 so I had to dig deeper to the problem and at least figure out how to solve the ‘wider effect’ and avoid create new BufferedImage object every re-paint…
OK, as a reault of my research, I tried to write some kind of my rotate code adaptation. Here it is :
>tested
… so the result image rotated on -30 degrees tilt looks like this
I dearly hope the tip saves ones day 🙂
Thank you all for help