Sinaesthetic Sinaesthetic - 1 year ago 96
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 Source

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.