I have Java class with JList and ListSelectionListener:
final JList myList = new JList();
// ...
myList.addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
System.out.println("selected");
}
});
but output is
selected
selected
How should I change my code, that output should be one selected?
Try
if(e.getValueIsAdjusting())
{
System.out.println("Selected");
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With