This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JScrollBar in color ?

 
sheila edwards
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Thanks
 
Thomas Suer
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Tom
 
Jeremy Hooie
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Thanks,
Jeremy
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic