title: JComboBox Action listener
body: <p>I'm having this problem.
  I have multiple JComboBoxes (5 total).</p>
  
  <p>To each comboBox I add an ActionListener, but the same ActionListener for all of them, called: </p>
  
  <pre><code>ComboBoxActionPerformed(java.awt.event.ActionEvent e)
  </code></pre>
  
  <p>and when that action is performed I look at the event (e) and do:</p>
  
  <pre><code>JComboBox c = ((JComboBox)e.getSource());
  //DO WORK relating to c as thats the combobox that triggered.
  </code></pre>
  
  <p>but the problem is when I change something in any of my comboboxes the Action is always triggered by the last combo box to which I am attaching the actionlistner.</p>
  
  <p>anyone have any idea?</p>
  
  <p>I then switched to ItemListner.
  This is what im doing a</p>
  
  <pre><code>class MyActionListner implements ItemListener 
  {
      //STUFF
          @Override
          public void itemStateChanged(ItemEvent evt) 
          {
              //DO STUFF
      }
  }
  
  public JComboBox createCombo()
  {
      JComboBox box = new JComboBox();
          box.setModel(new javax.swing.DefaultComboBoxModel(new String[] 
                  { "val1", "val2","val3" }));
          RulesActionListner actionL = new RulesActionListner();
          box.addItemListener(actionL);
  return box;
  }
  </code></pre>
  
  <p>and createCombo gets called multiple times
  but regardless of which combo box item was changed in side my ItemStateChanged method its
  comming from the last combo box that was created</p>
  
  <p>createCombo is called at runtime, so i have a variable number of comboboxes.</p>