Scaling and zoom

南笙酒味 提交于 2019-12-02 00:50:17

问题


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:


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.



来源:https://stackoverflow.com/questions/7140852/scaling-and-zoom

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!