JOptionPane to appear on selected JCheckBox
Posted
by Venno
on Stack Overflow
See other posts from Stack Overflow
or by Venno
Published on 2010-03-28T12:54:09Z
Indexed on
2010/03/28
13:43 UTC
Read the original article
Hit count: 342
Hi all I am having some difficulties with adding a joptionpane in JcheckBox listener
public void itemStateChanged(ItemEvent evt) {
if(evt.getStateChange() == ItemEvent.SELECTED){
///some code
JOptionPane.showMessageDialog(null, "Message", "Alert",
JOptionPane.INFORMATION_MESSAGE);
}
}
so it works fine,but the problem is that the JCheckBox gets selected and immediately deselected how can I manage to fix this ?
Cheers
© Stack Overflow or respective owner