Sleep or wait function?

5,025 views
Skip to first unread message

darnyboi

unread,
Dec 28, 2007, 2:57:31 AM12/28/07
to Google Web Toolkit
Is there a way to call a thread sleep or wait function when using the
GWT? I wanted to show the contents of a togglebutton's down face for
2 seconds, and then reset it to the up face - pretty simple, but for
some reason I'm having trouble getting it to work.

Jason Morris

unread,
Dec 28, 2007, 3:11:15 AM12/28/07
to Google-We...@googlegroups.com
Remember that JavaScript is single-threaded, so GWT doesn't really have an
equivalent to "Thread.sleep".

What you probably want to do is use the com.google.gwt.user.client.Timer class.

Hope this helps ;)

elliot

unread,
Dec 28, 2007, 9:07:35 PM12/28/07
to Google Web Toolkit
If you still havent had any success with this, try using GWTs
com.google.gwt.user.client.Timer class
something like:

setToDownFace();
Timer togglebuttonTimer = new Timer() {
public void run() {
setToUpFace();
}
};
togglebuttonTimer.schedule(2000);


Timer is essentially a wrapper for JavaScript's setTimeOut.
Reply all
Reply to author
Forward
0 new messages