src/share/classes/javax/swing/ProgressMonitor.java

Print this page




  61  * milliseconds (default 500) the progress monitor will predict how long
  62  * the operation will take.  If it is longer than millisToPopup (default 2000,
  63  * 2 seconds) a ProgressDialog will be popped up.
  64  * <p>
  65  * From time to time, when the Dialog box is visible, the progress bar will
  66  * be updated when setProgress is called.  setProgress won't always update
  67  * the progress bar, it will only be done if the amount of progress is
  68  * visibly significant.
  69  *
  70  * <p>
  71  *
  72  * For further documentation and examples see
  73  * <a
  74  href="http://java.sun.com/docs/books/tutorial/uiswing/components/progress.html">How to Monitor Progress</a>,
  75  * a section in <em>The Java Tutorial.</em>
  76  *
  77  * @see ProgressMonitorInputStream
  78  * @author James Gosling
  79  * @author Lynn Monsanto (accessibility)
  80  */
  81 public class ProgressMonitor implements Accessible
  82 {
  83     private ProgressMonitor root;
  84     private JDialog         dialog;
  85     private JOptionPane     pane;
  86     private JProgressBar    myBar;
  87     private JLabel          noteLabel;
  88     private Component       parentComponent;
  89     private String          note;
  90     private Object[]        cancelOption = null;
  91     private Object          message;
  92     private long            T0;
  93     private int             millisToDecideToPopup = 500;
  94     private int             millisToPopup = 2000;
  95     private int             min;
  96     private int             max;
  97 
  98 
  99     /**
 100      * Constructs a graphic object that shows progress, typically by filling
 101      * in a rectangular bar as the process nears completion.




  61  * milliseconds (default 500) the progress monitor will predict how long
  62  * the operation will take.  If it is longer than millisToPopup (default 2000,
  63  * 2 seconds) a ProgressDialog will be popped up.
  64  * <p>
  65  * From time to time, when the Dialog box is visible, the progress bar will
  66  * be updated when setProgress is called.  setProgress won't always update
  67  * the progress bar, it will only be done if the amount of progress is
  68  * visibly significant.
  69  *
  70  * <p>
  71  *
  72  * For further documentation and examples see
  73  * <a
  74  href="http://java.sun.com/docs/books/tutorial/uiswing/components/progress.html">How to Monitor Progress</a>,
  75  * a section in <em>The Java Tutorial.</em>
  76  *
  77  * @see ProgressMonitorInputStream
  78  * @author James Gosling
  79  * @author Lynn Monsanto (accessibility)
  80  */
  81 public class ProgressMonitor implements Accessible, AutoCloseable
  82 {
  83     private ProgressMonitor root;
  84     private JDialog         dialog;
  85     private JOptionPane     pane;
  86     private JProgressBar    myBar;
  87     private JLabel          noteLabel;
  88     private Component       parentComponent;
  89     private String          note;
  90     private Object[]        cancelOption = null;
  91     private Object          message;
  92     private long            T0;
  93     private int             millisToDecideToPopup = 500;
  94     private int             millisToPopup = 2000;
  95     private int             min;
  96     private int             max;
  97 
  98 
  99     /**
 100      * Constructs a graphic object that shows progress, typically by filling
 101      * in a rectangular bar as the process nears completion.