Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to disable a particular Jliste element?

 
David Chen
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, there:

Is there any easy (straight forward) way to disable one particular element in a JList? So that user can't select it any longer (and meanwhile get it blurred out)?
Checked from internet, it seems that I should create my own ListCellRenderer and SelectionListener as well. Any other easy way to do it?

Highly appreciated if any suggestions

Thanks a lot
David
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd say you've mentioned the better way of doing it, but this might be
enough of a workaround

 
David Chen
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much Michael for your reply and sample code. It's very helpful.

Thanks a lot again

David
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic