Hi, How we can restrict to select max. no of items in a JList. Ex: JList has to restrict that user can select max of 3 selections which is having 50 items.
I don't think there is any direct way to do that but you can add a listener to the list (addListSelectionListener) that's notified each time a change to the selection occurs.In case user selects more than three you can call clearSelection() to change the selection to empty set.
Snigdha<br />Sun Certified Programmer for the Java™ 2 Platform