| Author |
|
Eswar Rao
Greenhorn
Joined: Oct 13, 2011
Posts: 3
|
|
Hi,
If I add the same reference of a ActionListener twice to a component then the actionPerformed method will be called twice for each action on that component ?
If yes if I remove the action listener as below will it remove both the listeners ?
myJcomboBox.addActionListener(myActionListener);
myJcomboBox.addActionListener(myActionListener);
Then remove the listener as below
myJcomboBox.removeActionListener(myActionListener);
Please clarify how this will work.
|
 |
Joanne Neal
Rancher
Joined: Aug 05, 2005
Posts: 3011
|
|
|
That sounds like the sort of thing you could write a program to test.
|
Joanne
|
 |
Mohamed Sanaulla
Bartender
Joined: Sep 08, 2007
Posts: 2927
|
|
Hi Eswar,
Please UseAMeaningfulSubjectLine
|
Mohamed Sanaulla | My Blog
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
|
You'd better make sure any listener is only added once, to prevent having to answer this question.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32689
|
|
Surely you’ld have to answer the question twice
And welcome to the Ranch
|
 |
 |
|
|
subject:
|
|
|