This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma 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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login

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

Changing the text colour of JList items

Rebecca Thornton

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.
Nathan Pruett

Joined: Oct 18, 2000
Posts: 4121

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


Write once, run anywhere, because there's nowhere to hide! - /. A.C.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Changing the text colour of JList items
It's not a secret anymore!