Hello I have two classes in java and am attempting to countdown to 0. I cannot change the code in minute second display and am having difficulty getting it to move from 10 to 0 on the display in minute second display because it calls invokeLater to Update the display and that does no get done until the end. If you could look at my code and give me any advice I would appreciate it.
You are calling the countdown() method directly from the actionPerformed() method, which executes in your event dispatch thread - the same thread to used to draw on the screen. Since you are performing the Thread sleeping inside countdown the Event Thread won't be able to do the work it is intended to do - update the GUI.
So you should move the countdown() code to a different thread, so that the GUI interface isn't blocked while counting.
You are also doing some redundant context switching (with SwingUtilities.invokeLater() to call a method that itself uses SwingUtilities.invokeLater()), and creating objects you don't use (for example the t = new Thread(count)). So your code has a lot of clean-up which can be done.
I think he's gonna try to grab my monkey. Do we have a monkey outfit for this tiny ad?