View Single Post
Old 01-03-2005, 08:43 PM   #1 (permalink)
cartmen34
Psycho
 
Location: the hills of aquafina.
[Java] ActionEvent confusion

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!
__________________
"The problem with quick and dirty, as some people have said, is that the dirty remains long after the quick has been forgotten" - Steve McConnell
cartmen34 is offline  
 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38