开发者

Swing rotate border

开发者 https://www.devze.com 2023-01-15 05:29 出处:网络
I\'m working on a swing program to d开发者_JS百科isplay several pictures. And one can rotate the picture (implemented each as a JComponent).

I'm working on a swing program to d开发者_JS百科isplay 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).


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

0

精彩评论

暂无评论...
验证码 换一张
取 消