In general, we recommend using Swing timers rather than
general-purpose timers for GUI-related tasks because Swing timers all
share the same, pre-existing timer thread and the GUI-related task
automatically executes on the event-dispatch thread. However, you
might use a general-purpose timer if you don't plan on touching the
GUI from the timer, or need to perform lengthy processing.
# 1 楼答案
文件:http://docs.oracle.com/javase/tutorial/uiswing/misc/timer.html
我建议使用
util.Timer
# 2 楼答案
不,仅当您正在处理EDT时才使用Swing计时器。 除此之外,您还可以使用
java.util.Timer
而且,Swing定时器比util定时器慢,因为它们是为在GUI上工作而设计的