Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Setting color for non-enabled component

 
dave taubler
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I'm trying to set the foreground color of a JComponent (particularly, a JTextField) when that JComponent is not enabled. The default behavior for SWING, of course, is to grey-out the text. Is there any way for me to override that grey color? Using setForeground(), either before or after the setEnabled() call, doesn't seem to do anything.
 
dave taubler
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay, two second after I posted that, I went back to the JavaDoc page and saw TextComponent.setDisabledTextColor(). Amazingly, that did the trick.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic