Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to grey out jlist items  RSS feed

 
sangeeta mittal
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have implemented JListModel in my swing application. Based upon some conditions I want to grey out some items in the list. Please provide solution for this..

Thanks & Regards
~sangs
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sangeeta,
Welcome to the Ranch.

You will need to provide a custom renderer which will specify the background/foreground color of the individual item
Check out http://java.sun.com/docs/books/tutorial/uiswing/components/list.html Scroll down to the section which talks about renderers
And don't forget, a grayed out item can still be selected by the user.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!