new Timer(int value, ActionListener act) : Timer « javax.swing « Java by API






new Timer(int value, ActionListener act)

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.Timer;

public class MainClass {
  public static void main(String args[]) {
    ActionListener actionListener = new ActionListener() {
      public void actionPerformed(ActionEvent actionEvent) {
        System.out.println("Hello World Timer");
      }
    };
    Timer timer = new Timer(500, actionListener);
    timer.start();
  }
}

           
       








Related examples in the same category

1.Timer: start()
2.Timer: stop()