Java tutorial
import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.Timer; public class Main implements ActionListener { Timer t = new Timer(1000, this); Main() { t.start(); } public void actionPerformed(ActionEvent e) { System.out.println("working"); } public static void main(String args[]) { Main main = new Main(); } }