Swing Timer,如何暂停和恢复它? [英] Swing Timer, how to pause and resume it?

查看:222
本文介绍了Swing Timer,如何暂停和恢复它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个计时器,计算花费的时间和其他计算,但我需要当我点击暂停按钮时,计时器暂停,然后恢复。我如何暂停?

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?

推荐答案

没有暂停&恢复计时器的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.

< a href =http://www.java2s.com/Code/Java/Swing-JFC/Anappletthatcountsdownfromaspecifiedtime.htm =noreferrer> http://www.java2s.com/Code/Java/Swing-JFC/ Anappletthatcountsdownfromaspecifiedtime.htm

希望这有帮助。

这篇关于Swing Timer,如何暂停和恢复它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆