Have a wheel listener exclusively consuming events
I have implemented a Java applet embedded in an html webpage. The applet implements a wheel listener in order to zoom in/out the displayed graphics. However, the browser is also interpreting the wheel movement and scrolling the page. Is there a possibility to consume the wheel listener event exclusively by the Java applet, W开发者_如何学编程henever the mouse is over the applet?
Events all implement a consume
function which should do exactly what you want: 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.
And yes MouseWheelEvent really implements (well inherits) this method ;)
精彩评论