Reputation: 1
I'am strugeling with making delays in GWT (client-side).
What I want is to have a break of a few seconds between the iterations of a for-loop. The first iteration should start instantly, but there has to be a pause between the following ones.
Anyone an idea?
Upvotes: 0
Views: 2171
Reputation: 1785
You can delay by using Timer
.
Try something like this:
Timer timer = new Timer() {
public void run {
// Whatever code you want to repeat
}
};
for(int i=0; i<10; i++) {
timer.schedule(100) //100 millisecond delay
}
Upvotes: 2
Reputation: 1
Threading concept could be used for your question
you could try having a counter of loop and check for condition inside loop that if counter is >1 the use thread sleep for some seconds...
Upvotes: 0