is Fast Click - Java Swing

Java examples for Swing:Mouse Event

Description

is Fast Click

Demo Code


//package com.java2s;

public class Main {
    public static void main(String[] argv) throws Exception {
        System.out.println(isFastClick());
    }//from   w w  w . j  a v  a2  s.co  m

    private static long lastClickTime;

    public synchronized static boolean isFastClick() {
        long time = System.currentTimeMillis();
        if (time - lastClickTime < 500) {
            return true;
        }
        lastClickTime = time;
        return false;
    }
}

Related Tutorials