java - How can I check to see if a valueChanged event of a Swing JList was changed via click or mouse? -


here's example code, using groovy's swingbuilder create code valuechanged event of jlist:

    mainlist.valuechanged = { event ->         if (event.isadjusting) {             index = mainlist.selectedindex             otherlist.clearselection()             otherindex = otherlist.selectedindex         } else {             mainlistselected = true             clearjlist(otherlist)         }     } 

i have 2 jlist's, , function kind of controls list allowed selected via mainlistselected variable. have change int eindex want use selection based on whether or not it's index mainlist or otherlist

i've read event.isadjusting, , fires twice on mouse click event. knowledge, think move out of there, need things happen differently if mouse causes event opposed using arrows. however, code, using arrow key navigation prevents index ever changing.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -