Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Creating Timer

 
TesL lian
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How am i suppose to create a timer? i am looking for something to replace my Thread.sleep which seems to be slowing down my program.


 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If Thread.sleep slows down the code, why do you have it in there?
 
TesL lian
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am looking for some sort of delays which does not affect my rendering loop. is there other recommendation? actually what i need is something more real-time then i can keep track of the different time for the different location.
 
Rob Spoor
Sheriff
Pie
Posts: 20669
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In what thread do you do the rendering? Is this is Swing application, or something else?

In Swing, you can use javax.swing.Timer combined with an ActionListener.
 
Campbell Ritchie
Sheriff
Pie
Posts: 50277
80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like a Swing-related question which I ought to move.
 
TesL lian
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Solved. Thanks all for your help.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic