user2385750
user2385750

Reputation: 1

Delays between Iterations of a for-loop in GWT

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

Answers (2)

enrybo
enrybo

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

Ashok_udhay
Ashok_udhay

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

Related Questions