我们如何计算过程的时间? [英] How can we count the time of process?

查看:98
本文介绍了我们如何计算过程的时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个 PopupPanel 并显示了它。我想在一分钟后隐藏它。在那一分钟内,过程不应该停止或暂停。我如何实现这种行为?

I created a PopupPanel and have shown it. I want to hide it after one minute has passed. During that one minute, the process should not be stopped or paused. How can I achieve this behavior?

推荐答案

GWT有自己的 计时器

GWT has its own implementation of Timer.

这里有一个非常小的例子:

Here a really small example:

public void onModuleLoad() {
    final PopupPanel popUp = new PopupPanel();
    Label text = new Label("gone in a sec");
    popUp.setWidget(text);

    Timer timer = new Timer() {

        @Override
        public void run() {
            popUp.hide();
        }

    };

    popUp.center();
    timer.schedule(3000);
}

这篇关于我们如何计算过程的时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆