The following relates to the LNF standard (metal).
If you just want to set a specific size, you can put this code before creating a JScrollPane (replace 40 with whatever size you prefer) ...
UIManager.put("ScrollBar.width", 40);
If you want to scale the scrollbar based on the default size, then something like this (before creating JScrollPane) ...
UIManager.put("ScrollBar.width", (int) ((int) UIManager.get("ScrollBar.width") * 2.5));
If you want to change it after creating JScrollPane, it will be a little more complicated, but not so bad ...
int scrollbarSize = <some dynamic value>; UIManager.put("ScrollBar.width", scrollbarSize); scrollPane.setVerticalScrollBar(scrollPane.createVerticalScrollBar()); scrollPane.setHorizontalScrollBar(scrollPane.createHorizontalScrollBar());
I hope this helps someone.
xtempore
source share