I am developing a desktop application in netbeans platform (netbeans module) in which i have a desktoppane and a jscrollbar. i have implemented MouseWheelListener and added
scrollBar.addMouseWheelListener(this);
in the constructor of the class. now when i am scrolling the wheel of mouse it do not scroll the scroll bar though i am getting values in the
private void scrollBarMouseWheelMoved(java.awt.event.MouseWheelEvent evt) {
System.out.println("mouse value is------------ " + evt.paramString());
}
ouput of above sout is
mouse value is------------ MOUSE_WHEEL,(8,49),absolute(0,0),button=0,clickCount=0,scrollType=WHEEL_UNIT_SCROLL,scrollAmount=3,wheelRotation=1
what should i do now to enable mosue wheel event on jscrollbar?
I have searched but i found events for scrollpane but i am looking for scrollbar explicitly..
i have removed extra code and shown what i am looking for in the following sample code
public final class ScrollableWindow1TopComponent extends TopComponent implements ComponentListener, MouseWheelListener {
private javax.swing.JScrollBar scrollBar;
private javax.swing.JDesktopPane scrollableGraphnewContainer;
public ScrollableWindow1TopComponent() {
this.addComponentListener(this);
scrollBar.addMouseWheelListener(this);
}
private void scrollBarMouseWheelMoved(java.awt.event.MouseWheelEvent evt) {
System.out.println("mouse value is------------ " + evt.paramString());
}
private void scrollBarAdjustmentValueChanged(java.awt.event.AdjustmentEvent evt) {
//code that works fine
}
}