Scaling and zoom

2019-02-25 04:53发布

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: the 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.

1条回答
对你真心纯属浪费
2楼-- · 2019-02-25 05:11

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.

查看更多
登录 后发表回答