Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

 
Eswar Rao
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That sounds like the sort of thing you could write a program to test.
 
Mohamed Sanaulla
Saloon Keeper
Posts: 3159
33
Google App Engine Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Eswar,
Please UseAMeaningfulSubjectLine
 
Rob Spoor
Sheriff
Pie
Posts: 20529
54
Chrome Eclipse IDE Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'd better make sure any listener is only added once, to prevent having to answer this question.
 
Campbell Ritchie
Sheriff
Pie
Posts: 48954
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Surely you’ld have to answer the question twice

And welcome to the Ranch
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic