Swing rotate border
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.
精彩评论