Search code examples
titleprogressmonitor

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


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

  • progressMonitor.setProgress(0);
  • ...
  • progressMonitor.setProgress(100);

This works fine for me, but now I want to change the title of this progress monitor. Currently its "Progress...".


Solution

  • You can set the title of the dialog window through the UIManager:

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

    enter image description here