缩放和缩放 [英] Scaling and zoom

查看:189
本文介绍了缩放和缩放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要为 JScrollPane 中包含的 JDesktopPane 实现缩放。通过覆盖 paintComponent(...)方法并调用 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).

这不能正常工作: JInternalFrame JPanel 按预期缩放,但是 MouseListener 用于 JLabel 并且在预先缩放的位置。我能做什么?谢谢你的阅读。

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.

推荐答案

ScaledPanel 显示如何使用显式转换方法缩放鼠标坐标: scaleX scaleY unScaleX unScaleY 。或者,您可以使用逆转换,如此处

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.

这篇关于缩放和缩放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆