Win a copy of Murach's MySQL this week in the JDBC and Relational Databases forum!
  • 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

trapping double clicks using getClickCount of MouseEvent

 
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'd like to know if there is a better way to trap double clicks then using getClickCount() in MouseEvent?
Using getClickCount is not reliable in my tests. Most of the time when I trap double clicks it is not working 100% of the time. One has to click slowly in order for it to be somewhat reliable.
Has anyone seen this problem?
 
Ranch Hand
Posts: 286
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
easy to get around. Use a
Date lastClick;
variable. Check lastClick.getTime() in the mouseClicked method (or mousePressed).
If it is within a certain number of milisecs of the current time, its a double click and you kick off your event.
If it is out of the time range you specify it sets the lastClick to the current time and exits waiting for the next click.
Hope this helps,
Chris
[ October 07, 2002: Message edited by: Chris Shepherd ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic