Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Single-Double Click  RSS feed

 
Amaresh Patra
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
Can anybody tell me in the mouse double click event how to prevent single click event from happening. Whenever I double click both single as well as double click events are fired.
Awaiting a quick response
Amaresh
 
Rob Ross
Bartender
Posts: 2205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't prevent it.
My advice is to re-think your design to handle the concept of a single click, as well as a double click.
Failing that, you can always add MouseListeners to whatever components you want to "prevent" from getting a single mouse click, then keep track of the click count yourself, and only process mouse clicks when they are double clicks.
Good Luck!
Rob
 
Paul Stevens
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use the getClickCount() of the mouseclicked event.
if (evt.getClickCount() == 2) {
//do something
}
The implication is else do nothing.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!