• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to change the color of scrollbars  RSS feed

 
cs sakthi
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai guys,
I tried to change the color of scrollbars but it does'nt work, this is the code:
JScrollPane scrollPane = new JScrollPane( table,
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED );
scrollPane.getHorizontalScrollBar().setBackground(Color.yellow);
scrollPane.getHorizontalScrollBar().setForeground(Color.red);
The above code changes the color of the background for Scrollbar but not for the foreground.
Can anyone tell me how to change the color of Scrollbars? (with code)
Thanks,
Sakthi.

[This message has been edited by cs sakthi (edited June 12, 2001).]
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

one suggestion: after the setForeground method call,
try a getForeground method and see that the color was
infact set. I will update if I find something more.
ps: I don't expect any surprises here, it should infact
have been set.
- satya
 
cs sakthi
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes the getForeground() method call gives the color that i had set ie RED actually. but it appears to be BLUE(default) in the panel. Waiting for your reply...
Thanks,
Sakthi.
[This message has been edited by cs sakthi (edited June 13, 2001).]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!