• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Serious Problem with Double click of JButton..

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
what if we put solar panels on top of the semi truck trailer? That could power this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic