我已经实现了一个嵌入到 html 网页中的 Java 小程序。该小程序实现了一个滚轮监听器,以便放大/缩小显示的图形。然而,浏览器也在解释滚轮移动和滚动页面。 是否有可能在鼠标悬停在小程序上时由 Java 小程序专门使用滚轮监听器事件?
最佳答案
所有事件都实现了一个consume
函数,它应该完全按照您的意愿执行:Docs
consume
public void consume()
Consumes this event so that it will not be processed in the
default manner by the source which originated it.
是的,MouseWheelEvent 确实实现了(很好地继承了)这个方法;)
关于java - 有一个 wheel listener 专门消费事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7374983/