I see the method JScrollPane.setWheelScrollingEnabled(boolean)
to enable or disable the mouse wheel scrolling. Is there any way to adjust the speed of the scrolling, though? It is, in my opinion, ludicrously slow. No matter what size I make the window, the scrolling is about three pixels per click. I'd like it to be much more than that.
Any ideas?
One way would be to set the unit increment of the scrollbar to a larger number:
You can do this by setting the unit increment for a ScrollBar. See the example.
My solution to speeding up the scroll:
Add scrollbar's parameter:
scrollPane.getVerticalScrollBar().putClientProperty("JScrollBar.fastWheelScrolling", true);
Implement a wheel listener (on the component inside jViewport):
The increase of wheelRotation is necessary: otherwise the number of scrolled lines will be limited to the size of the screen.
I was trying to find a better method to read through 32000 lines in my ScrollPane
try this
scrollPane.getVerticalScrollBar().setUnitIncrement(100); scrollPane.getViewport().putClientProperty("EnableWindowBlit", Boolean.TRUE); scrollPane.getViewport().setScrollMode(JViewport.BACKINGSTORE_SCROLL_MODE);
A quick search brought up this page: How to increase the JScrollPane scrolling speed for mousewheel users. It turns out that the scrolling increment is a property of the scroll bar itself (
JScrollBar.setUnitIncrement
) and not the scroll pane.You can try this :