So I wanted to make a timer to know when the user presses a button, however it doesn't seem to work the way it should.
When I put something in the public void actionPerformed()
method it doesn't repeat at all - it should do it every 10th millisecond as I told it to. I have no clue what it might be because there are 0 warnings and 0 errors.
Here is the code:
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.Timer;
public class timertest {
static Timer timer = new Timer(10,new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
System.out.println("test");
}
});
public static void main(String[] args) {
timer.start();
}
}