posted 18 years ago
Well if you had other activities happening in the main method, that would work too. The problem is that you set the timer so that the actionPerformed method is called every second. When you create the timer, that does not stop the main method from executing. It goes to the next line, and then it is finished. So the main method exits before the first second.
Note that using Thread.sleep does not create a new thread. There is a thread that is running the main method. Whatever thread executes Thread.sleep is the one that will pause.
[ March 30, 2006: Message edited by: Keith Lynn ]