[英]Destroy messageBox by Timer
我在程序中显示了一些messageBox。 例如,如果我成功保存数据,messageBox会显示“ Successfull”。 但是我想在定时器之前关闭它。 当它超过两秒钟时,应该关闭它。我不需要准备好的代码。 如果您告诉我这样做的方法就足够了。 我的平台是GWT。
最好的祝福..
除了Timer之外,可能还有其他更好的方法。 但是,使用计时器时,您将使用GWT的com.google.gwt.user.client.Timer类。
Timer t = new Timer() {
public void run() {
Window.alert("Nifty, eh?");
// your messageBox code
t.cancel(); // Since you only need this run once.
}
};
// Schedule the timer to run once in 2 seconds.
t.schedule(2000);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.