title: Java JComboBox listen a change selection event
body: <p>I'm trying to listen to a change of selection in a Java JComboBox. I have tried to use an ActionListener but the problem is this: the action listener does something like this </p>
  
  <pre><code>public void actionPerformed(ActionEvent e){
      JComboBox&lt;String&gt; source = ((JComboBox&lt;String&gt;)e.getSource());
      String selected = source.getItemAt(source.getSelectedIndex());
  
      /*now I compare if the selected string is equal to some others 
        and in a couple of cases I have to add elements to the combo*/
  }
  </code></pre>
  
  <p>As you can notice, when I need to add elements to the combo another event is fired and the actionPerformed method is called again, even if I don't want that, and the code may loops... :(
  Is there any way to listen to the selection change only and not to a generic change event?
  Thanks</p>