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();
}