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 ?
How to de-select a JList item from my program
The JList should have a clearSelection()
method that you can call.
I was having a problem finding a way to do this - but this easily cleared it up. Thanks much, though its a shame there is not a simpler way to clear the selection (such as say, setting the selected index to -1 or something). –
Saguaro
© 2022 - 2024 — McMap. All rights reserved.