• Post Reply Bookmark Topic Watch Topic
  • New Topic

Timed events  RSS feed

 
Unnar Björnsson
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Stuart Gray
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Unnar Björnsson
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ed Ewing
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Unnar Björnsson
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!