aspose file tools
The moose likes Swing / AWT / SWT and the fly likes Need help with JList selection modes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Need help with JList selection modes" Watch "Need help with JList selection modes" New topic

Need help with JList selection modes

Robert Miller
Ranch Hand

Joined: Jun 18, 2004
Posts: 56
I have an application using a JList and I want to implement the additional restriction that as long as the list is non-empty there will always be one element selected. I am using the SINGLE_SELECTION model but that allows the user to deselect the current item and leave no elements selected. I suspect I can accomplish what I want using a ListSelectionListener but I haven't found enough documentation on that object for me to determine whether it would be helpful.

Is there anyone out there who can help me out with this?


Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
Don't get me started about those stupid light bulbs.
subject: Need help with JList selection modes