Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Maintain the Foreground text color in JList[urgent]

 
netharam ram
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I have a JList with some String elements.When I set setEnabled(false), the text's foreground color becomes dull.How to avoid this dull screen over the JList even after setEnabled(false).Please reply as soon as possible.
Happy middling with java.
Netharam
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It "grays out" the label to show the user that it cannot be selected... normally, this is really something you would really want to do...

But if you don't you'll have to override the default ListCellRenderer...



-Nate
 
Jennifer Sohl
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. I want to do the same thing but with a JTextField. Can anyone tell me how this is done?
By the way, does anyone know a good book that has little tips like these, or is it just common knowledge after working with Java for so long?
Thanks for your help!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic