【发布时间】:2011-05-21 16:45:12
【问题描述】:
我在 Java Swing 应用程序中有这样的功能。单击按钮后,我需要间隔和循环调用许多功能。必须在 jbutton 内部调用函数,因为我在 View 中有一些用于 jbutton 函数的全局参数。你能帮我如何在调用函数之间创建时间延迟以及如何在 jLabel 中显示剩余时间吗?
private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {
statusMessageLabel.setText("Proccess started.");
for(int i=0;i< cycles;i++) {
//display remaining time
jLabelTimer.setText("00:09:59");
// after time call many functions and then go again
manyFunctions();
} catch (Exception e) {
System.out.println(e);
}
statusMessageLabel.setText("Proccess ended.");
}
}
【问题讨论】: