how to detect double clicks in MouseInput in Java swing?
How can I catch when user double clicks on the component?
window.getComponent().addMouseListener(new MouseInputAdapter(){
public void mouseClicked(final java.awt.event.MouseEvent evt) {
Xpcom.invokeLater(new Runnable() {
public void run() {
}
});
开发者_如何学JAVA }
})
;
You'll have to use the getClickCount()
of MouseEvent
if (evt.getClickCount() == 2) // double click
{
// do stuff
}
See the following post:
Distinguish between a single click and a double click in Java
精彩评论