It's not a secret anymore!*
The moose likes Swing / AWT / SWT and the fly likes UIManager Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "UIManager" Watch "UIManager" New topic
Author

UIManager

mira yang
Ranch Hand

Joined: Nov 08, 2003
Posts: 33
When we want to change the UI default value,we use code like this :
UIManager.put("Tree.background", new Color(32,33,220));
UIManager.put("Tree.textBackground", new Color(240,22,240));
But how can i know the other string value, like "Tree.background"? For example,when i want to change the scrollbar's color ,what to do and where i can find the whole info about those work?
sorry , my english was very poor!
Thanks!
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

You can call getDefaults() or getLookAndFeelDefaults() on UIManager() and then call keys() or keySet() on the returned UIDefaults object to get all the current keys you can set values for. Most are pretty self-explanatory, but I'd test them out to make sure the look and feel you are using uses them like you think, and make sure they aren't used in other places.


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Brian Pipa
Ranch Hand

Joined: Sep 29, 2003
Posts: 299
I actually wrote a program/class to do this - allows you to see the current values visually. It's not totally done, but if anyone wants to see it, I can post what I have so far. I have some cool ideas for it just haven't gotten around to adding them.
Brian
[ March 18, 2004: Message edited by: Brian Pipa ]

My Java Freeware:<br />MACCC - <a href="http://maccc.pipasoft.com" target="_blank" rel="nofollow">http://maccc.pipasoft.com</a><br />Nator - <a href="http://nator.pipasoft.com" target="_blank" rel="nofollow">http://nator.pipasoft.com</a>
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: UIManager
 
Similar Threads
JCheckboxMenuItem won't change selection color
Jtree Ugly Look
Changing colors in JTree
selection color for buttons
JSlider knob color