public static void main(String[] args) throws Exception {
createTestUI();
monitor = new ProgressMonitor(frame, "Progress", null, 0, 100);
robotThread = new TestThread();
robotThread.start();
for (counter = 0; counter <= 100; counter += 10) {
Thread.sleep(1000);
EventQueue.invokeAndWait(new Runnable() {
@Override
public void run() {
if (!monitor.isCanceled()) {
monitor.setProgress(counter);
System.out.println("Progress bar is in progress");
}
}
});
if (monitor.isCanceled()) {
break;
}
}
disposeTestUI();
if (counter >= monitor.getMaximum()) {
throw new RuntimeException("Escape key did not cancel the ProgressMonitor");
}
}
ProgressMonitorEscapeKeyPress.java 文件源码
java
阅读 26
收藏 0
点赞 0
评论 0
项目:openjdk-jdk10
作者:
评论列表
文章目录