I’m trying to create a form with a JList and a button
What I want to do, is select an item from the JList, and then press the button to perform an action dependant on the selection. However, as soon as the button is clicked, the JList loses focus, and the selection disappears, making the button unable to determine what element was selected in the JList.
Is there a solution to this?
Thanks in advance 🙂
I can’t see any issue with example from Oracle JList tutorial
have look at ListSelectionListener
maybe carefully with SelectionModes
can you please to describe whats is your goal
code example