< prev index next >

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

Print this page




 243 
 244         /*
 245          * Returns the AccessibleJOptionPane
 246          */
 247         private AccessibleContext getAccessibleJOptionPane() {
 248             return super.getAccessibleContext();
 249         }
 250     }
 251 
 252 
 253     /**
 254      * Indicate the progress of the operation being monitored.
 255      * If the specified value is &gt;= the maximum, the progress
 256      * monitor is closed.
 257      * @param nv an int specifying the current value, between the
 258      *        maximum and minimum specified for this component
 259      * @see #setMinimum
 260      * @see #setMaximum
 261      * @see #close
 262      */

 263     public void setProgress(int nv) {
 264         if (nv >= max) {
 265             close();
 266         }
 267         else {
 268             if (myBar != null) {
 269                 myBar.setValue(nv);
 270             }
 271             else {
 272                 long T = System.currentTimeMillis();
 273                 long dT = (int)(T-T0);
 274                 if (dT >= millisToDecideToPopup) {
 275                     int predictedCompletionTime;
 276                     if (nv > min) {
 277                         predictedCompletionTime = (int)(dT *
 278                                                         (max - min) /
 279                                                         (nv - min));
 280                     }
 281                     else {
 282                         predictedCompletionTime = millisToPopup;




 243 
 244         /*
 245          * Returns the AccessibleJOptionPane
 246          */
 247         private AccessibleContext getAccessibleJOptionPane() {
 248             return super.getAccessibleContext();
 249         }
 250     }
 251 
 252 
 253     /**
 254      * Indicate the progress of the operation being monitored.
 255      * If the specified value is &gt;= the maximum, the progress
 256      * monitor is closed.
 257      * @param nv an int specifying the current value, between the
 258      *        maximum and minimum specified for this component
 259      * @see #setMinimum
 260      * @see #setMaximum
 261      * @see #close
 262      */
 263     @SuppressWarnings("deprecation")
 264     public void setProgress(int nv) {
 265         if (nv >= max) {
 266             close();
 267         }
 268         else {
 269             if (myBar != null) {
 270                 myBar.setValue(nv);
 271             }
 272             else {
 273                 long T = System.currentTimeMillis();
 274                 long dT = (int)(T-T0);
 275                 if (dT >= millisToDecideToPopup) {
 276                     int predictedCompletionTime;
 277                     if (nv > min) {
 278                         predictedCompletionTime = (int)(dT *
 279                                                         (max - min) /
 280                                                         (nv - min));
 281                     }
 282                     else {
 283                         predictedCompletionTime = millisToPopup;


< prev index next >