How to deselect Jlist item on some event in java
21,028
Try myJList.clearSelection(); It clears the selection(s) on your JList object. If multiple list items selected together, they can also be deselected via this method.
Author by
Jony
Updated on July 24, 2022Comments
-
Jony almost 2 years
could any one suggest me any method or any other way in java that i could deselect my jlist item when some event occurs? i tried this but this does not seem to work
myJList.setSelectedIndex(-1); myJList.ensureIndexIsVisible(-1);