• Post Reply Bookmark Topic Watch Topic
  • New Topic

delay time  RSS feed

 
Jing Liang
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

I am looking for a method or class that can delay calling my method at a defined interval. Does anyone have an idea? Thanks
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Either the java.util.Timer or javax.swing.Timer class should do what you need.
 
Jing Liang
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ernest

The javax.swing.Timer will call my method at every interval time but I only want it delay the time to call my method once. Do you know how could I fix this?
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> but I only want it delay the time to call my method once.

timer.setRepeats(false);
 
Jing Liang
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Michael
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!