# Ignore single click on double triple four etc click

**URL:** <https://discourse.processing.org/t/ignore-single-click-on-double-triple-four-etc-click/36990>\
**Category:** Processing\
**Created:** [May 21, 2022, 9:05am UTC](https://discourse.processing.org/t/ignore-single-click-on-double-triple-four-etc-click/36990 "2022-05-21T09:05:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![xxlinxx](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/xxlinxx/32/15873_2.png) [@xxlinxx](https://discourse.processing.org/u/xxlinxx)\
**Post date:** [May 21, 2022, 9:05am UTC](https://discourse.processing.org/t/ignore-single-click-on-double-triple-four-etc-click/36990/1 "2022-05-21T09:05:01Z")

</div>

```auto
public void mousePressed(MouseEvent e) {
        if (e.getButton() == LEFT) {
            clickTimerStart(e);
            if(e.getCount()==1){

            }
            else if(e.getCount()==2){
                //also triger above e.getCount()==1
            }
            else if(e.getCount()==3){
                //also triger above e.getCount()==1
                //also triger above e.getCount()==2
            }
        }
    }
    Timer timer;
    int totalClick=0;
    void clickTimerStart(MouseEvent e){
        if(timer!=null){
            timer.restart();
            totalClick++;
            return;
        }
        totalClick++;
        Integer timerinterval = (Integer) Toolkit.getDefaultToolkit().getDesktopProperty("awt.multiClickInterval");
        // cant get if u r usin MAC OS. default multiClickInterval =200
        timer = new Timer(200, new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                switch(totalClick){
                    case 1:
                        System.out.println("[clickTimer][END]1 totalClick="+totalClick+"/"+e.getCount());
                        break;
                    case 2:
                        System.out.println("[clickTimer][END]2 totalClick="+totalClick+"/"+e.getCount());
                        break;
                    case 3:
                        System.out.println("[clickTimer][END]3 totalClick="+totalClick+"/"+e.getCount());
                        break;
                    case 4:
                        System.out.println("[clickTimer][END]4 totalClick="+totalClick+"/"+e.getCount());
                        break;
                }
                totalClick=0;
            }
        });// http://decade.tw
        timer.setRepeats(false);
        timer.start();
    }

```
