This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Changing the text colour of JList items Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "Changing the text colour of JList items" Watch "Changing the text colour of JList items" New topic
Author

Changing the text colour of JList items

Rebecca Thornton
Greenhorn

Joined: Dec 20, 2001
Posts: 1
is it possible to change the text colour of only certain items in a JList, rather than every item - I want selected items to be a different colour to items that have not been selected so the user can recognise which they have already selected.
Thanks
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

You'll need to make a new ListCellRenderer and do something like the following...



-Nate


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Changing the text colour of JList items
 
Similar Threads
error linking the JRadio button with the JList
Which Swing component to use ?
Remove JList
programmatic change of text item color in JLIst
problem selecting JList item