• Post Reply Bookmark Topic Watch Topic
  • New Topic

Buttons don't always react

 
Tristan Van Poucke
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The button's on my applet work in a very strange way.
Sometimes they react when you click them the first time and othertimes you have to click them a couple of times before they react.
I am using standard JButtons.
This is an example on how I call the method that has to be called when the button is clicked



Is this a frequent problem with applets or is something wrong with my code?
 
Joe Ess
Bartender
Posts: 9370
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why aren't you using an ActionListener instead of a MouseListener? ActionListeners are the usual way to listen for button presses.
Have a look at the Button Examples in the Swing Tutorial.
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!