How can we count the time of process?

前端 未结 3 1370
生来不讨喜
生来不讨喜 2021-01-17 18:09

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. Ho

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-17 18:41

    Try to use: java.util.Timer

    And you can do something like this:

    int seconds = 60;
    Timer timer = new Timer();
    timer.schedule(new YourScheduledTask(), seconds * 1000);
    

    Exmaple: Use java.util.Timer to schedule a task to execute once 5 seconds have passed

提交回复
热议问题