• Post Reply Bookmark Topic Watch Topic
  • New Topic

how i can bring an sleep between two operation?  RSS feed

 
raminaa niilian
Ranch Hand
Posts: 551
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Thank you for reading my post.
How i can Make a puse between two statements.
for example
I have a call to a function like DoOperatioOne();
now i want to have 5 seconds pause and then go for
next function
DoOperationTwo();

is there any solution ? I dont want my GUI to hang or become none responsive.
 
Kaj Bjurman
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Take a look at javax.swing.Timer. You can use that one and schedule a task to execute after five seconds.

Kaj
 
Adam Richards
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Even simpler:
 
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
Originally posted by Adam Richards:
Even simpler:


But one requirement was not to freeze the GUI, which this will (if called from an event handler, of course, which I think was implied.)
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!