This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design 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: 20511
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
Posts: 48652
56
  • 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
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic