This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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?
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 ]