Mouse event with double click in java

后端 未结 5 2124
借酒劲吻你
借酒劲吻你 2020-12-18 19:49

By default MouseClicked event starts with one click. I have one in a JTextPane but I want to start with double click. Is it possible?

5条回答
  •  没有蜡笔的小新
    2020-12-18 20:38

    You can override the mousePressed() or mouseReleased() methods and asking if e.getClickCount() == 2 , I recommend using the mousePressed() or mouseReleased() instead of mouseClicked() method since using those will give the user more time to perform the clicks.

提交回复
热议问题