开发者

Re-setting the delay after the timer has started to fire

开发者 https://www.devze.com 2023-03-14 06:09 出处:网络
In my program i have a timer that fires event every 100th of a second.The timer starts as soon as my program starts.开发者_运维问答(The call to start the timer is from the constructor)

In my program i have a timer that fires event every 100th of a second.The timer starts as soon as my program starts.开发者_运维问答(The call to start the timer is from the constructor)

Is there any way to reset the the delay of firing events by the timer once it has started?

My timer starts in the following fashion :

new Timer( 100 , taskPerformer).start();

why i am trying to achieve this:

As soon as the program starts Bouncing ball animation starts.I have a JSlider that goes from 0 to 1000 miliseconds on it's scale.Initially the delay is set to 100th milisecond. I should be able to reset the delay using JSlider. I am done with my program except resetting the delay.

What is the method?


You can also change the timer's delay afterwards using method Timer.setDelay(...);.

0

精彩评论

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