How Do I Create A Timer In The Simplest Way Possible? [duplicate]

This question already has an answer here:

How to solve this Timer issue in java?

4 answers

How to create a timer which can be used multiple times in Java

1 answer

For my code I have this:

import java.awt.event.*;

import javax.swing.*;

public class Three implements ActionListener {

public static void main(String[] args) {

Three three = new Three();

Timer timer = new Timer(10000, three);

timer.start();

}

int count = 0;

public void actionPerformed(ActionEvent e) {

this.count += 1;

System.out.println( this.count );

}

}

This to me appears like it should work - but unfortunately it doesn't. There is no error, but it doesn't...

Read More »

By: StackOverFlow - Wednesday, 7 November

Related Posts