开发者

Swing Timer, how to pause and resume it?

开发者 https://www.devze.com 2023-01-12 07:35 出处:网络
i have a timer that counts the spent time and other calculations, but i need when i click on pause button 开发者_运维问答the timer to pause, and then resume. How do i pause it?There is no pause &

i have a timer that counts the spent time and other calculations, but i need when i click on pause button 开发者_运维问答the timer to pause, and then resume. How do i pause it?


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

Hope this helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消