Dear All, How to capture scroll bar event in java.
+4
A:
Here is a piece of code that will get you started:
// Listen for value changes in the scroll pane's scrollbars
AdjustmentListener listener = new MyAdjustmentListener();
pane.getHorizontalScrollBar().addAdjustmentListener(listener);
pane.getVerticalScrollBar().addAdjustmentListener(listener);
class MyAdjustmentListener implements AdjustmentListener {
@Override
public void adjustmentValueChanged(AdjustmentEvent arg0)
{
// TODO Your code here
}
}
Bobby
2010-02-18 08:24:15