开发者

Scaling and zoom

开发者 https://www.devze.com 2023-03-29 11:47 出处:网络
I need to implement zoom for a JDesktopPane contained in a JScrollPane. I have had prior success zooming by overriding the paintComponent(...) method and calling scale(double,double).

I need to implement zoom for a JDesktopPane contained in a JScrollPane. I have had prior success zooming by overriding the paintComponent(...) method and calling scale(double,double).

This is not working properly: 开发者_如何学Pythonthe JInternalFrame's and JPanel's scale as intended, but the MouseListener's for the JLabel's and such register at the pre-scaled locations. What can I do? Thank you for reading.


ScaledPanel shows how to scale mouse coordinates using explicit transformation methods: scaleX, scaleY, unScaleX and unScaleY. Alternatively, you can use an inverse transformation, as shown here.

0

精彩评论

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