Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization 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
Pie
Posts: 42967
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: 20495
54
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
Posts: 48424
56
  • 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