Answer the question
In order to leave comments, you need to log in
How to change MouseWheelListener with javassist?
There is a compiled java application without source codes. It is required to change the reaction of the program to the movement of the mouse wheel. Initially, there is an up / down movement, I want to zoom in / out, it is implemented using the interface buttons.
The obvious option is to use javassist. But there is one caveat - it does not work with inner and anonymous classes. Therefore, simply creating another MouseWheelListener will not work, like this:
this.removeMouseWheelListener(this.getMouseWheelListeners()[0]);
MouseWheelListener mwl = new MouseWheelListener(){
@Override
public void mouseWheelMoved(MouseWheelEvent mwe) {
AbstractCanvas.this.setZoom(AbstractCanvas.this.getZoom() + mwe.getUnitsToScroll() * 20, null, mwe.getPoint());
AbstractCanvas.this.refreshComponents();
}
};
this.addMouseWheelListener(mwl);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question