Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

UIManager keynames  RSS feed

 
April.Johnson
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been customizing the look and feel of my JApplet using Java 1.2.
I have been using the UIManager.put method to change things like the tooltip background and foreground and other such things. I found the keynames (for example, "Tooltip.background") for the things I've already changed through lucky guesses and a bit of combing the archives on this site.
But now I'm stuck. I want to change more things and I haven't been able to guess the keynames for the things I want to change.
I found a "question of the week" on Sun's website that suggested that I could use UIManager.getDefaults() to see what the keynames were. So I eagerly tried to send this to the console. Only problem was, it throws a java.util.NoSuchElementException from the Hashtable Enumerator on the UIManager.getDefaults().toString() call.
Now I really am stuck. Can somebody help me work around this problem of the exception or point me in a better direction to find my goal of knowing the keynames so I can set my own look and feel?
Specifically, right now, I'm looking to change the color of the scrollbar in a JComboBox, but it'd be handy to know the other stuff, too.
Thanks so much for your help.
April
[This message has been edited by April.Johnson (edited May 09, 2001).]
 
Swamy Vatti
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try this one....

UIDefaults uid = UIManager.getDefaults();
Enumeration e1 = uid.keys();
Enumeration e2 = uid.elements();
loop thru the enumerations and u'll get the keys and their default values. And for example u want to change a label background use
UIManager.put("Label.background", Color.Magenta);
Hope u get thru...
 
April.Johnson
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perfect! Thanks for the help.
April
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!