swing - java DefaultListModel -
if(incasationbegin > 0) { int anwser = joptionpane.showconfirmdialog(null, config.question,"confirm", joptionpane.yes_no_option); if(anwser == 1) { jlist0.setselectedindex(incasationbegin); return; } } incasationbegin = jlist0.getselectedindex(); how setselectedindex without calling jlist0listselectionvaluechanged action? because when click on option confirm popup , when click no, new item still selected. have tried add incasationbegin =0; before return, on first click confirm popup.
let me see if understood correctly. adding listselectionlistener jlist , want prevent call setselectedindex firing valuechanged event, it?
you can try lot of different approaches here:
- delay call
jlist0.addlistselectionlistener(...in such way no listener exists when callsetselectedindex. - have listener
valuechangedmethod check "enabled condition", example readboolean isenabled. set condition false before callingsetselectedindex, true after that. - call
jlist0.removelistselectionlistener(..before callsetselectedindex. add listener list again after call.
Comments
Post a Comment