如何更改 Java 中 ProgressMonitor 的标题?

How can I change the title of a ProgressMonitor in Java?

ProgressMonitor progressMonitor = new ProgressMonitor(frame, "", "", 0, 100);

这对我来说很好用,但现在我想更改此进度监视器的标题。当前 "Progress...".

你可以这样做:

monitor.beginTask("Running Job..", IProgressMonitor.UNKNOWN);
monitor.beginTask("Job #1");

但我不相信盒子的实际标题会改变。

您可以通过 UIManager 设置对话框的标题window:

String title = "Foobar";
UIManager.put("ProgressMonitor.progressText", title);
ProgressMonitor progressMonitor = new ProgressMonitor(frame, "", "", 0, 100);
...