ComboBox - ItemStateChanged Event - is being fired twice
843806Apr 1 2009 — edited Apr 1 2009I'm getting 2 Message Dialogs when I select a different item on a JComboBox. I've debugged the application and found that the event was being fired twice even when I've changed the item once.
Here's the sample code (Using Netbeans IDE 6.5.1 to design and code)
{color:#993300}private void jComboBox1ItemStateChanged(java.awt.event.ItemEvent evt)
{
// TODO add your handling code here:
JOptionPane.showMessageDialog(null, "Hi", "Hello", JOptionPane.ERROR_MESSAGE);
}
{color}
Is this expected? In case it is, can someone help me with the correct code, that will display the message dialog only once.+