e648. 双击和三击事件

    
component.addMouseListener(new MyMouseListener());
    
    public class MyMouseListener extends MouseAdapter {
        public void mouseClicked(MouseEvent evt) {
            if (evt.getClickCount() == 3) {
                // triple-click
            } else if (evt.getClickCount() == 2) {
                // double-click
            }
        }
    }

 

Related Examples
posted @ 2018-09-02 21:29  borter  阅读(145)  评论(0编辑  收藏  举报