且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Swing Timer,如何暂停和恢复它?

更新时间:2023-12-03 23:01:52

没有暂停&恢复计时器的API。您将需要为其编码。

There is no pause & resume API for Timer. You will need to code for it.

这是暂停和恢复计时器鼠标悬停的示例。

Here is example which pauses and resumes Timer on mouseover.

http://www.java2s.com/Code/Java/Swing-JFC/ Anappletthatcountsdownfromaspecifiedtime.htm

希望这有帮助。