Results 1 to 8 of 8
- 11-06-2011, 09:16 PM #1
Member
- Join Date
- Oct 2011
- Posts
- 9
- Rep Power
- 0
How can I change a timer's delay?
Hi! I have a timer with its initial delay set at 200ms. and after some event happens I want to change it. What do I have to do to do this without creating a new timer? I am using a Swing timer.
What the timer does is repaint(), I think it should be taken into acount.
Thanks!!Last edited by chrishans; 11-06-2011 at 09:32 PM.
- 11-06-2011, 09:24 PM #2
Re: How can I change a timer's delay?
Have you looked at the API doc to see if the Timer class has any methods that will do what you want?
- 11-06-2011, 10:04 PM #3
Member
- Join Date
- Oct 2011
- Posts
- 9
- Rep Power
- 0
Re: How can I change a timer's delay?
Yes, there's a setDelay method, but wherever I put it, I doesn't work as I want.
- 11-06-2011, 10:07 PM #4
Re: How can I change a timer's delay?
Do you have a small program you can post to demo your problem?
Can you explain how you want it to work.
- 11-08-2011, 04:49 PM #5
Member
- Join Date
- Oct 2011
- Posts
- 9
- Rep Power
- 0
Re: How can I change a timer's delay?
I am working on a Snake clone game. I have a timer which "moves" the snake every 200ms by changing the position of each square of the Snake, and then repaints. I want to change that delay, decrease it, when the score reaches, eg. 10, so that the snake moves faster.
- 11-08-2011, 04:52 PM #6
Re: How can I change a timer's delay?
Can you explain what the problem is?I doesn't work as I want.
Can you make a small program that shows the problem?
- 11-08-2011, 05:00 PM #7
Member
- Join Date
- Oct 2011
- Posts
- 9
- Rep Power
- 0
Re: How can I change a timer's delay?
I'm so sorry! I don't know WTF happened, but now it works. I used the setDelay method, which I had already used but didn't work. I really don't know what I did wrong the other time.
Thanks for your time, anyway!!
- 11-08-2011, 05:07 PM #8
Similar Threads
-
change thread.sleep() to timer.
By MaximumDolphin in forum Java AppletsReplies: 16Last Post: 04-15-2011, 12:55 AM -
can i set a timer delay on mouseEntered event
By chan in forum AWT / SwingReplies: 1Last Post: 08-30-2009, 05:55 AM -
change the delay between double click in mouse listener
By itaipee in forum AWT / SwingReplies: 6Last Post: 03-17-2009, 02:23 AM -
How to cancel an individual timer in spite of canceling whole timer
By Java Tip in forum java.utilReplies: 0Last Post: 04-04-2008, 02:46 PM -
XML parsing with 10sec delay using timer class
By srikanthn in forum XMLReplies: 0Last Post: 02-05-2008, 10:59 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks