This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes How to set color of scrollbar in scrollpane? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "How to set color of scrollbar in scrollpane?" Watch "How to set color of scrollbar in scrollpane?" New topic
Author

How to set color of scrollbar in scrollpane?

Thomas Fly
Ranch Hand

Joined: Sep 09, 2002
Posts: 164
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?


Fly by Night Consultants<br /> <blockquote><font size="1" face="Verdana, Arial">quote:</font><hr><i>I climbed on the back of a giant albatross<br />which flew through a crack in the cloud<br />to a place where happiness reigned...<br />all year 'round<br />the music played ever so loudly!</i><p><a href="http://thomasfly.com/songs/Traffic/Hole_in_my_Shoe_qt.htm" target="_blank" rel="nofollow">Hole in My Shoe</a><hr></blockquote>
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
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


Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Sumeet Gaikwad
Ranch Hand

Joined: Mar 07, 2002
Posts: 37
Hi Thomas,
Here is the code for changing the scrollbar color.

hope this help ....


Sumeet Gaikwad<br />SCJP, SCWCD<br />-----------------------------------------------------------------------------------<br />Nothing is impossible because it spells... I M Possible !!!
Sarita Gupta
Ranch Hand

Joined: Aug 12, 2002
Posts: 43
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...


There are no great people in this world, only great challenges which ordinary people rise to meet.
Sumeet Gaikwad
Ranch Hand

Joined: Mar 07, 2002
Posts: 37
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

Joined: Sep 09, 2002
Posts: 164
Thanks for the info, Michael & Sumeet, I'll try it out!
Thomas Fly
Ranch Hand

Joined: Sep 09, 2002
Posts: 164
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

Joined: Jan 30, 2002
Posts: 3451
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

Joined: Sep 09, 2002
Posts: 164
Hi Michael-
Yeah, I found it: javax.swing.plaf.basic.BasicLookAndFeel
John Smith
Ranch Hand

Joined: Oct 08, 2001
Posts: 2937

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

Joined: Sep 09, 2002
Posts: 164
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

Joined: Sep 09, 2002
Posts: 164
Maybe I should have a Look & Feel menu item so that the assessor can select between "Art Deco" and "1984"
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi Thomas,
Have you considered talking to a therapist? Or maybe taking Prozac?
Michael Morris
Thomas Fly
Ranch Hand

Joined: Sep 09, 2002
Posts: 164
Exactly my plans just as soon as the job comes thru with the CIA
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
OOOOWW!! Pretty!
Thomas Fly
Ranch Hand

Joined: Sep 09, 2002
Posts: 164

There's a sucker born every minute hehe
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
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

Joined: Sep 09, 2002
Posts: 164
Close enough?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to set color of scrollbar in scrollpane?
 
Similar Threads
Scrollbar thumb color
How To Show a Vertical Scrollbar Inside FIELDSET
Change colour of Toolbar
Scrollbar Look
How to highlight a hyperlink?(Urgent)