title: Why is itemStateChanged on JComboBox is called twice when changed?
body: <p>I'm using a JComboBox with an ItemListener on it. When the value is changed, the itemStateChanged event is called twice. The first call, the ItemEvent is showing the original item selected. On the second time, it is showing the item that has been just selected by the user. Here's some tester code:</p>
  
  <pre><code>public Tester(){
  
      JComboBox box = new JComboBox();
      box.addItem("One");
      box.addItem("Two");
      box.addItem("Three");
      box.addItem("Four");
  
      box.addItemListener(new ItemListener(){
          public void itemStateChanged(ItemEvent e){
              System.out.println(e.getItem());
          }
      });
  
      JFrame frame = new JFrame();
      frame.getContentPane().add(box);
      frame.pack();
      frame.setVisible(true);
  }
  </code></pre>
  
  <p>So when I changed the Combo box once from "One" to "Three" the console shows:<br><br></p>
  
  <pre><code>One
  Three
  </code></pre>
  
  <p>Is there a way I can tell using the ItemEvent maybe, that it's the second item (ie. the user selected item)? And if someone can explain why it gets called twice, that would be nice too!</p>
  
  <p>Thanks</p>