gpt4 book ai didi

java - 检测 mouseReleased 方法中的双击

转载 作者:太空宇宙 更新时间:2023-11-04 08:07:34 25 4
gpt4 key购买 nike

我需要使用 mouseReleased 方法而不是 mouseClicked,所以我需要找到一种方法来拦截双击。这是代码:

public void mouseReleased(MouseEvent e)
{
if (e.getClickCount() == 2)
System.out.println ("Double CLICK mouseReleased");
else
{
row= clientTable.rowAtPoint(e.getPoint());
col= clientTable.columnAtPoint(e.getPoint());

clientTable.sel(row, col);
}
}

问题是,当我双击时,我还有一个单击事件。谁能知道如何解决这个问题吗?谢谢

最佳答案

1.使用MouseEvent类的getClickCount()方法

2.这将帮助您获取点击类型.. Single、Double、Triple等..

请参阅此处了解更多详细信息:

http://docs.oracle.com/javase/6/docs/api/java/awt/event/MouseEvent.html

关于java - 检测 mouseReleased 方法中的双击,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11828609/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com