Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

thread 101  RSS feed

 
Kate Zoy
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to have something in my program refreshed every 2 seconds. I have done threads a really long time ago, and I can't remember how to create this simple thread. What's the simplest way?
Thanks alot!!
 
Yaroslav Chinskiy
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kate,

For running something every 2 sec u dont need a therad, look at java.util.Timer

You can also check a tutorial at http://java.sun.com/docs/books/tutorial/essential/threads/index.html
 
Kate Zoy
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks alot. I did read about the timer and it was very easy. My code works perfectly Thanks for the advice!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!