【发布时间】:2015-05-17 21:02:03
【问题描述】:
我有一个应用程序,我想在其中稍作停顿。让图形元素/更改在两个自动交互之间更清晰可见是很重要的。
我尝试使用上面的代码暂停 2 分钟,但它会导致方法开始时暂停,而不是在方法内的 2 行确切的代码之间。
try {
Thread.sleep(2000);
} catch(InterruptedException ex) {
Thread.currentThread().interrupt();
}
【问题讨论】:
-
你试过wait()和notify()吗?