Does anyone know how to get mouse events from the arrow buttons on the end of a JScrollBar? I have tried this...
.. but the event is only fired when the mouse is pressed over the "Thumb" or track area of the JScollBar. I can't use an AdjustmentListener because the contents are changing dynamically at run time and I need to be able to differentiate between a user generated event and a change to the contents.
One straightforward way of doing it would be to traverse the component tree rooted at the JScrollBar. The buttons will be instances of javax.swing.BasicArrowButton (I think, but use JButton to be safe), so whenever you come across a child component that is an instance of that class you add your MouseListener.
Another approach would be to override the ScrollBarUI -- the buttons have protected access in BasicScrollBarUI.