Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Serious Problem with Double click of JButton..

 
Khalid Shafquat
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Developers,
im having some serious kind of problem , with JButton Double click . what i need when some user double clicks (or by pressing enter key very fast 2 times ) the action behind the listener for that button is executed two times that is not desied because it has some financial transactions behind it and aloowing user pressing button two times means mess up with the database and some serious situation ..
I have tried almost every thing by disabling the button for certain period and ....blaaah blaah by applying diff flags in the code ...but what i want is SOME GENERIC solution for this coz we have a lots of GUIs (more than 500) in the application and atleast there are 2 buttons present on each screen.
So please help us out in this problem and let me know if any one have any solution about the problem.
I will be thankful to the person /Team /Organization.
Khalid Shafquat
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Khalid,
Instead of attaching an ActionListener to the JButton, you might try attaching a MouseListener instead and do something like this:

Hope this helps,
Michael Morris
 
Thomas Suer
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What about disabling the button immediately after the user clicks on it the first time? And after executing the task you could enable the button again...
Hope that helps
Tom
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic