package tanakahda.apps.progressmonitor;
import java.util.concurrent.TimeUnit;
import javax.swing.JFrame;
import javax.swing.ProgressMonitor;
public class Main {
public static void main(String[] args) {
var frame = new JFrame();
frame.setSize(640, 480);
frame.setVisible(true);
new Thread(()->{
ProgressMonitor pm = new ProgressMonitor(
frame,
"説明メッセージ:どの操作が監視されているかユーザーに示す",
"状態を説明する短いメモ",
0, 100);
pm.setMillisToDecideToPopup(100);
pm.setMillisToPopup(100);
for (int i = 0; i <= 100; i++) {
pm.setNote("進捗率 = " + i + "%");
pm.setProgress(i);
try {
TimeUnit.MILLISECONDS.sleep(200);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
pm.setNote("終了");
}).start();
}
}