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

Why ComboBox.disabledForeground not work when set editable?  RSS feed

 
David Chen
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, there:

I use UIManager.getDefaults().put("ComboBox.disabledForeground", Color.GRAY ) to define the fore ground color when my JComboBox is disabled. However, just noticed that if I set JComboBox Editable to be true, then, the application seems using the default disabledForeground color instead of the one I defined (ex. gray).
For example:



The above code works fine and set foregound color as gray. However, if I added the line: comboBox.setEditable(true); The application just uses default foreground color (light blue in 1.5).

Does any one know why?
Highly appreciated if any comments or hints.

Thanks a lot in advance.

David
 
Ben Zung
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As the property name suggesting, UIManager is setting the color for "comboBox.disabledForeground". And when you set a comboBox to be editable, it takes the editor's default fore/background color. You could set a renderer to it or when you set it to be editable, you can play around like this

to set the color to what you want.

HTH.
 
David Chen
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much Ben, it makes scense. I'll try your way later.

Thanks a lot again
David
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!