• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to set color of scrollbar in scrollpane?

 
Thomas Fly
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've got a slick pastel color scheme for my GUI, but then there's this butt ugly gray vertical scrollbar stuck in the middle of it.doesn't do anything.
Is it some big chore to change this color, or am I missing something here?
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Thomas,

Is it some big chore to change this color, or am I missing something here?

Probably a big chore. I think you will have to do something with plaf (pluggable look and feel) to change the color. I am certainly no expert in this area, but I think that ScrollBarUI always sets the color based on the current plaf and not on any component color.

I've got a slick pastel color scheme ...

Do you do interiors?
Michael Morris
 
Sumeet Gaikwad
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Thomas,
Here is the code for changing the scrollbar color.

hope this help ....
 
Sarita Gupta
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A second look at ur code, Sumeet, i think i'll give it a pass... for first grey suits me fine...and second, i ain't got the time...
 
Sumeet Gaikwad
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sarita
Originally posted by Sarita Gupta:
A second look at ur code, Sumeet, i think i'll give it a pass... for first grey suits me fine...and second, i ain't got the time...

You can change the color as per your choice.....Try it with different colors...
 
Thomas Fly
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the info, Michael & Sumeet, I'll try it out!
 
Thomas Fly
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey that works great. I was able to make UIManager tell me what properties it's controlling withbut does anybody know where (what file) all that's actually coming from?
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Thomas,
I don't think there is a file but a look and feel class that sets up the UIDefaults HashTable.
Michael Morris
 
Thomas Fly
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Michael-
Yeah, I found it: javax.swing.plaf.basic.BasicLookAndFeel
 
John Smith
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Is it some big chore to change this color, or am I missing something here?

I would strongly encourage you to follow the Sun's Java Look & Feel conventions and not modify the colors. You might lose a few points for making your table red with yellow scrollbars.
Eugene.
 
Thomas Fly
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the suggestion Eugene- I will at least look at the L&F conventions, though frankly the idea that one should adhere to such makes me think of that 1984 Apple Macintosh commercial where an athletic young woman comes running into the Big Brother convention and makes a hammer throw that smashes the video screen...
 
Thomas Fly
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe I should have a Look & Feel menu item so that the assessor can select between "Art Deco" and "1984"
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Thomas,
Have you considered talking to a therapist? Or maybe taking Prozac?
Michael Morris
 
Thomas Fly
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Exactly my plans just as soon as the job comes thru with the CIA
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OOOOWW!! Pretty!
 
Thomas Fly
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

There's a sucker born every minute hehe
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Man I thought the '60s were over! All you need to complete the ambiance is Hendrix singing All Along the Watchtower
 
Thomas Fly
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Close enough?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic