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

Print this page




  83  *</pre>
  84  *
  85  * Here is an example of putting a progress bar into
  86  * indeterminate mode,
  87  * and then switching back to determinate mode
  88  * once the length of the task is known:
  89  *
  90  *<pre>
  91  *progressBar = new JProgressBar();
  92  *<em>...//when the task of (initially) unknown length begins:</em>
  93  *progressBar.setIndeterminate(true);
  94  *<em>...//do some work; get length of task...</em>
  95  *progressBar.setMaximum(newLength);
  96  *progressBar.setValue(newValue);
  97  *progressBar.setIndeterminate(false);
  98  *</pre>
  99  *
 100  * <p>
 101  *
 102  * For complete examples and further documentation see
 103  * <a href="http://java.sun.com/docs/books/tutorial/uiswing/components/progress.html" target="_top">How to Monitor Progress</a>,
 104  * a section in <em>The Java Tutorial.</em>
 105  *
 106  * <p>
 107  * <strong>Warning:</strong> Swing is not thread safe. For more
 108  * information see <a
 109  * href="package-summary.html#threading">Swing's Threading
 110  * Policy</a>.
 111  * <p>
 112  * <strong>Warning:</strong>
 113  * Serialized objects of this class will not be compatible with
 114  * future Swing releases. The current serialization support is
 115  * appropriate for short term storage or RMI between applications running
 116  * the same version of Swing.  As of 1.4, support for long term storage
 117  * of all JavaBeans<sup><font size="-2">TM</font></sup>
 118  * has been added to the <code>java.beans</code> package.
 119  * Please see {@link java.beans.XMLEncoder}.
 120  *
 121  * @see javax.swing.plaf.basic.BasicProgressBarUI
 122  * @see javax.swing.BoundedRangeModel
 123  * @see javax.swing.SwingWorker


 893      * @see    BoundedRangeModel#setMaximum
 894      * @beaninfo
 895      *    preferred: true
 896      *  description: The progress bar's maximum value.
 897      */
 898     public void setMaximum(int n) { getModel().setMaximum(n); }
 899 
 900     /**
 901      * Sets the <code>indeterminate</code> property of the progress bar,
 902      * which determines whether the progress bar is in determinate
 903      * or indeterminate mode.
 904      * An indeterminate progress bar continuously displays animation
 905      * indicating that an operation of unknown length is occurring.
 906      * By default, this property is <code>false</code>.
 907      * Some look and feels might not support indeterminate progress bars;
 908      * they will ignore this property.
 909      *
 910      * <p>
 911      *
 912      * See
 913      * <a href="http://java.sun.com/docs/books/tutorial/uiswing/components/progress.html" target="_top">How to Monitor Progress</a>
 914      * for examples of using indeterminate progress bars.
 915      *
 916      * @param newValue  <code>true</code> if the progress bar
 917      *                  should change to indeterminate mode;
 918      *                  <code>false</code> if it should revert to normal.
 919      *
 920      * @see #isIndeterminate
 921      * @see javax.swing.plaf.basic.BasicProgressBarUI
 922      *
 923      * @since 1.4
 924      *
 925      * @beaninfo
 926      *        bound: true
 927      *    attribute: visualUpdate true
 928      *  description: Set whether the progress bar is indeterminate (true)
 929      *               or normal (false).
 930      */
 931     public void setIndeterminate(boolean newValue) {
 932         boolean oldValue = indeterminate;
 933         indeterminate = newValue;




  83  *</pre>
  84  *
  85  * Here is an example of putting a progress bar into
  86  * indeterminate mode,
  87  * and then switching back to determinate mode
  88  * once the length of the task is known:
  89  *
  90  *<pre>
  91  *progressBar = new JProgressBar();
  92  *<em>...//when the task of (initially) unknown length begins:</em>
  93  *progressBar.setIndeterminate(true);
  94  *<em>...//do some work; get length of task...</em>
  95  *progressBar.setMaximum(newLength);
  96  *progressBar.setValue(newValue);
  97  *progressBar.setIndeterminate(false);
  98  *</pre>
  99  *
 100  * <p>
 101  *
 102  * For complete examples and further documentation see
 103  * <a href="http://docs.oracle.com/javase/tutorial/uiswing/components/progress.html" target="_top">How to Monitor Progress</a>,
 104  * a section in <em>The Java Tutorial.</em>
 105  *
 106  * <p>
 107  * <strong>Warning:</strong> Swing is not thread safe. For more
 108  * information see <a
 109  * href="package-summary.html#threading">Swing's Threading
 110  * Policy</a>.
 111  * <p>
 112  * <strong>Warning:</strong>
 113  * Serialized objects of this class will not be compatible with
 114  * future Swing releases. The current serialization support is
 115  * appropriate for short term storage or RMI between applications running
 116  * the same version of Swing.  As of 1.4, support for long term storage
 117  * of all JavaBeans<sup><font size="-2">TM</font></sup>
 118  * has been added to the <code>java.beans</code> package.
 119  * Please see {@link java.beans.XMLEncoder}.
 120  *
 121  * @see javax.swing.plaf.basic.BasicProgressBarUI
 122  * @see javax.swing.BoundedRangeModel
 123  * @see javax.swing.SwingWorker


 893      * @see    BoundedRangeModel#setMaximum
 894      * @beaninfo
 895      *    preferred: true
 896      *  description: The progress bar's maximum value.
 897      */
 898     public void setMaximum(int n) { getModel().setMaximum(n); }
 899 
 900     /**
 901      * Sets the <code>indeterminate</code> property of the progress bar,
 902      * which determines whether the progress bar is in determinate
 903      * or indeterminate mode.
 904      * An indeterminate progress bar continuously displays animation
 905      * indicating that an operation of unknown length is occurring.
 906      * By default, this property is <code>false</code>.
 907      * Some look and feels might not support indeterminate progress bars;
 908      * they will ignore this property.
 909      *
 910      * <p>
 911      *
 912      * See
 913      * <a href="http://docs.oracle.com/javase/tutorial/uiswing/components/progress.html" target="_top">How to Monitor Progress</a>
 914      * for examples of using indeterminate progress bars.
 915      *
 916      * @param newValue  <code>true</code> if the progress bar
 917      *                  should change to indeterminate mode;
 918      *                  <code>false</code> if it should revert to normal.
 919      *
 920      * @see #isIndeterminate
 921      * @see javax.swing.plaf.basic.BasicProgressBarUI
 922      *
 923      * @since 1.4
 924      *
 925      * @beaninfo
 926      *        bound: true
 927      *    attribute: visualUpdate true
 928      *  description: Set whether the progress bar is indeterminate (true)
 929      *               or normal (false).
 930      */
 931     public void setIndeterminate(boolean newValue) {
 932         boolean oldValue = indeterminate;
 933         indeterminate = newValue;