Sinaesthetic Sinaesthetic - 3 months ago 12
Java Question

java scrollbar thickness

Is there a way to adjust the thickness of the scrollbar within a JScrollPane? the default is kind of clunky.

Answer

A quick but also dirty solution is to set the width/height explicitely to e.g. 10 pixels via

jScrollPane.getVerticalScrollBar().setPreferredSize(new Dimension(10, 0));
jScrollPane.getHorizontalScrollBar().setPreferredSize(new Dimension(0, 10));

Other way would be to provide a proper ScrollBarUI.