I don't know why all ProgressMonitor fields are private. Probably not Mr. Godsling's proudest creation :)
* @author James Gosling
* @author Lynn Monsanto (accessibility)
* @version 1.37 04/12/06
Just clone it, along with some package private stuff from Swing, then you can do whatever you want, like add a flag for cancelability, and use it in ProgressOptionPane's constructor.
(UPDATE) If you can't derive JDK code under SCSL, then here is a devious way to get hold of the JDialog, then you can do anything you want, including removing the Cancel button:
progressMonitor = new ProgressMonitor(ProgressMonitorDemo.this,
"Running a Long Task",
"", 0, 100);
progressMonitor.setMillisToDecideToPopup(0);
progressMonitor.setMillisToPopup(0);
progressMonitor.setProgress(0);
JDialog dialog = (JDialog)progressMonitor.getAccessibleContext().getAccessibleParent();
JOptionPane pane = (JOptionPane)dialog.getContentPane().getComponent(0);
pane.setOptions(new Object[]{});
It's ugly, and it's totally dependent on ProgressMonitor's implementation. So you should check for ClassCastException and null.
Why do you need to set both time periods to 0? Otherwise the dialog is not created in setProgress.