Suhail Gupta
Suhail Gupta

Reputation: 23276

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

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?

Upvotes: 2

Views: 620

Answers (1)

Howard
Howard

Reputation: 39207

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

Upvotes: 2

Related Questions