Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to de-select a JList item from my program

Tags:

java

jlist

I have a JList, and a JButton, user can click an item in the JList or they can click the button, when the button is clicked how do I de-select (change the selected list item bgcolor to normal, in other words, nothing in the JList will be selected after the button is clicked) the item from the JList ?

like image 776
Frank Avatar asked Sep 01 '09 03:09

Frank


1 Answers

The JList should have a clearSelection() method that you can call.

like image 164
Thomas Owens Avatar answered Oct 11 '22 07:10

Thomas Owens