Ok, I'm confused. I'm being told one thing by my book and I'm seeing the exact opposite when I implement the listener. Here's the quote straight from the Swing book I bought:
"Combo boxes fire both and ItemEvent and an ActionEvent when the selection in the list has changed. the ItemEvent is fired when there is a change in the current selection of the list, from any source. the ActionEvent is fired when the user explicitly makes a selection; it is coupled with the actionCommand property."
so.....
Code:
cboPlayerList.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
getPlayersYears(); //populate the cboPlayersYears combobox
}
});
However, when some other code updates the items list in cboPlayerList getPlayersYears() gets called, even though no user interaction has taken place on the PlayerList combobox! What am I misunderstanding or what have I misread?
Thanks for your help guys!