Forums Register Login

Timed events

+Pie Number of slices to send: Send
Im using timer to make objects move on the screen.

TimeListener is the actionlistener.
I found that 20 is good delaytime but when I run the application on my laptop everything moves faster as if the delay was set to 10.
How do I make the timer consistent between all computers?
+Pie Number of slices to send: Send
The time should be the same across machines. Then again, 20 milliseconds is such a short time that it is hard to measure - how are you determining that the delay varies? Try a larger time interval (say 2000 milliseconds) and see what happens.
+Pie Number of slices to send: Send
 

Originally posted by Stuart Gray:
The time should be the same across machines. Then again, 20 milliseconds is such a short time that it is hard to measure - how are you determining that the delay varies? Try a larger time interval (say 2000 milliseconds) and see what happens.



But that would make it 2 seconds an animation with 2 second delay time between frames is very slow. I make the icon on screen update it�s Y-coordinates every 20 ms, 2 seconds is way too much.
+Pie Number of slices to send: Send
 

Originally posted by Unnar Bj�rnsson:


But that would make it 2 seconds an animation with 2 second delay time between frames is very slow. I make the icon on screen update it�s Y-coordinates every 20 ms, 2 seconds is way too much.



Just a guess, but maybe you are changing the Y-coordinate by a fixed number of pixels, and the screen resolution on your laptop is lower than on your other computer. If this is the case, then the icon would appear to move faster on the laptop, even though it is updating the same number of times per second.
+Pie Number of slices to send: Send
 

Originally posted by Ed Ewing:


Just a guess, but maybe you are changing the Y-coordinate by a fixed number of pixels, and the screen resolution on your laptop is lower than on your other computer. If this is the case, then the icon would appear to move faster on the laptop, even though it is updating the same number of times per second.



Nope same resolution, and refresh rate.
pie. tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1148 times.
Similar Threads
What is going on here?
Help with timer
slowing down movement in an applet.... doesn't have anything to do with the applet.
ActionListener: Non-static variable 'this' cannot be referenced from a non-static context????
Clock
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 02:05:07.