Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.Timer;

public class Main {
    public static void runTimer(int duration, final Runnable run) {
        Timer t = new Timer(duration, new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                run.run();
            }
        });

        t.setRepeats(false);
        t.start();
    }
}