JscrollPane doesn't receive mousewheelevent when add it in JSPlitPane
inside Matlab
I've made a simple GUI in Swing with a big JPanel (displaying a big
BufferedImage) inside a JScrollPane, inside a JSPlitPane, inside a JPanel,
.... inside a JFrame.
When running/displaying my JFrame directly from Eclipse IDE, the
JScrollPane receive correctly the mousewheel event and scroll when I
scrolled my mouse wheel.
But when running from Matlab (I've build a JAR), the JScrollPane doesn't
scroll when I've scroll the mouse wheel.
I've try to add manually mousewheellistener with some syso to
debub/understand the problem, like this:
jscrollpane.addMouseWheelListener(new MouseWheelListener() {
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
System.err.println("jscrollpane mouse wheel event");
}
});
jsplitpane.addMouseWheelListener(new MouseWheelListener() {
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
System.err.println("jsplitpane mouse wheel event");
}
});
When running directly from Eclipse IDE, it's displayed "jscrollpane mouse
wheel event" (this is OK). But when running my GUI from Matlab, it's
displayed "jsplitpane mouse wheel event".
I've also add this piece of code to be sure that my jscrollpane has a
mousewheellistener:
for (MouseWheelListener listener : jscrollpane.getMouseWheelListeners()) {
System.err.println("ONE LISTENER FOR JSCROLLPANE");
}
And it's displayed two times (one time for my syso listener, and one time
for the builtin mousewheellistener of the jscrollpane component).
So what happen in Matlab for the JScrollPane component? What can I do to
force JscrollPane to receive MouseWheel events?
I think Matlab update the general awt mask events to prevent jscrollpane
catching mousewheel event?
No comments:
Post a Comment