This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design 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