Is it good to use a swing timer outside of a swing?
2 answers
In general, we recommend using Swing timers rather than generic timers for GUI-related tasks, since all Swing timers share the same pre-existing timer thread and the GUI-related task is automatically executed on the event dispatch thread. However, you can use a general-purpose timer if you do not plan to touch the GUI from the timer or require lengthy processing.
Documentation: http://docs.oracle.com/javase/tutorial/uiswing/misc/timer.html
I recommend using util.Timer
.
+4
source to share