Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Changing the text colour of JList items

 
Rebecca Thornton
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll need to make a new ListCellRenderer and do something like the following...



-Nate
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic