wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes Maintain the Foreground text color in JList[urgent] Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Maintain the Foreground text color in JList[urgent]" Watch "Maintain the Foreground text color in JList[urgent]" New topic
Author

Maintain the Foreground text color in JList[urgent]

netharam ram
Ranch Hand

Joined: Aug 09, 2001
Posts: 202
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

Joined: Oct 18, 2000
Posts: 4121

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


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

Joined: Feb 28, 2001
Posts: 455
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!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Maintain the Foreground text color in JList[urgent]
 
Similar Threads
JList with Thread
Setting color for non-enabled component
foreground color
JComboBox: Opaque problem
Checkbox using Swing