ProgressMonitor pMonitor=new ProgressMonitor(jf,"Import order","",0,100);
pMonitor.setNote("process...");
pMonitor.setMillisToDecideToPopup(0);
pMonitor.setMillisToPopup(1100);
pMonitor.setProgress(0);
for (int i=0;i<101;i++){//长度是0-100,所以...^^
   pMonitor.setProgress(i);
   try{
   Thread.currentThread().sleep(100);//太快了,给它慢下来,见下面解释
}catch(Exception e1){
System.out.println ("ft");
}
}A class to monitor the progress of some operation. If it looks like the operation will take a while, a progress dialog will be popped up. When the ProgressMonitor is created it is given a numeric range and a descriptive string. As the operation progresses, call the setProgress method to indicate how far along the [min,max] range the operation is. Initially, there is no ProgressDialog. After the first millisToDecideToPopup milliseconds (default 500) the progress monitor will predict how long the operation will take. If it is longer than millisToPopup (default 2000, 2 seconds) a ProgressDialog will be popped up. From time to time, when the Dialog box is visible, the progress bar will be updated when setProgress is called. setProgress won't always update the progress bar, it will only be done if the amount of progress is visibly significant.