It’s strange that JScrollPane doesn’t have a method addAdjustmentListener(). Yet adjustmentListener is said to be used with scrollbars. I want something to happen whenever the JScrollPane is scrolled in either way. How to achieve such a thing?
It’s strange that JScrollPane doesn’t have a method addAdjustmentListener() . Yet adjustmentListener is said
Share
Why don’t you get the actual scrollbars, and then add adjustment listeners to them?
JScrollBarhas a method calledaddAdjustmentListener().And you can use
getVerticalScrollBar()andgetHorizontalScrollBar()to get aJScrollBarfrom aJScrollPane