Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swing rotate border

I'm working on a swing program to display several pictures. And one can rotate the picture (implemented each as a JComponent).

Problem is, when a picture gets rotated, the border of the JComponent doesn't change so that the picture gets clipped.

Is there any way to also rotate the border so that the picture can be fully drawn?

(I know one can calculate the new size of the border, but it leaves empty space on the edge. When a rotated picture overlaps with another and one want to move the one underneath, one cannot do that because the event will be passed to the picture above, onto the transparent edge. So it is more ideal if one can just rotate the border).

like image 805
zavié Avatar asked May 28 '26 15:05

zavié


1 Answers

Execute another pack() on your top-level JFrame after rotating.

like image 104
Steve McLeod Avatar answered Jun 01 '26 22:06

Steve McLeod



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!