• Post Reply Bookmark Topic Watch Topic
  • New Topic

ActionEvent firing twice

 
David Robinson
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having trouble with the code of my action event objects firing twice while using a JButton. I am only adding it once to the button (as far as I can tell anyways). Before I post a whole bunch of code, since I'm assuming this happens to other people besides me, I thought I would ask if anyone can think of common causes to this problem so I can try to hunt for the bug one more time.

Thanks!
 
Darryl Burke
Bartender
Posts: 5154
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, it doesn't happen to other people. you've added the ActionListener more than once. Post an SSCCE -- not all your code -- that demonstrates the problem.

And welcome to the Ranch!
 
David Robinson
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Geeze. I am having a hard time replicating the problem with simpler code. And I use the same technique to create each JButton, but it only seems to happen with the one. Here is the sample code I've come up with so far... (note: Don't believe I'm not at fault, just assuming some other doofus has made a similar mistake)

import javax.swing.*;
import java.awt.event.*;
import java.util.*;

 
Darryl Burke
Bartender
Posts: 5154
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Robinson wrote:Geeze. I am having a hard time replicating the problem with simpler code. ... Here is the sample code I've come up with so far...

Does it demonstrate the problem?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!