jQuery in Action, 3rd edition
The moose likes Swing / AWT / SWT and the fly likes JScrollBar in color ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JScrollBar in color ?" Watch "JScrollBar in color ?" New topic

JScrollBar in color ?

sheila edwards

Joined: Sep 12, 2001
Posts: 1
How do I specify the color of a JScrollBar ?
I've tried combinations of setForeground, setBackground and
trying to set various items to transparent (setOpaque(false)) but nothing seems to work.
Thomas Suer
Ranch Hand

Joined: Sep 03, 2001
Posts: 50
Try to set the appropriate properties of the UIManager (before the gui gets displayed).
E.g. UIManager.put("ScrollBar.background", Color.red);
If the gui is already displayed you additionally have to call the updateUI() method of the component.
Good luck
Jeremy Hooie
Ranch Hand

Joined: Aug 22, 2001
Posts: 38
I'm using the UIManager to change the colors of a JScrollBar and I've successfully changed the track and thumb colors, but I can't change the adjustment buttons. They don't seem to be JButtons, but I can't find a key for it in ScrollBar.
I agree. Here's the link: http://aspose.com/file-tools
subject: JScrollBar in color ?
It's not a secret anymore!