Hi,
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).
Thank you very much!
Cheers, Shuo
EDIT I have since no longer put the pictures each in its own JComponent
rather flatly in the super panel. Mouse events are translated into AffineTransform
s. Now it works great and the cropped border problem no longer exists!