This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

actionPerformed() called twice

 
Emili Calonge
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've got a problem with a button in my program that calls the actionPerformed() twice (at least I think so) the code is this:


If I debug this code with the eclipse debugger I can see that it is entering the actionperformed function twice. I don't understand what's happening as I have other buttons with the same exact code (except the action commands) and they work perfectly. Hope anyone can help me. Thanks.
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perhaps you're calling addActionListener again elsewhere.
 
Emili Calonge
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yep, I hate me so much when I do this things with copy paste. Thanks.
 
leon liu
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In fact,Your code exactly call the actionListener twice,Maybe you can
print the message on your console,why the button had been active twice.......
 
Emili Calonge
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The error was that I had another button with the same action command. I don't see why you say that this code is calling actionlistener twice.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic