Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  *  Copyright (c) 2011 Leibniz Institute of Plant Genetics and Crop Plant Research (IPK), Gatersleben, Germany.
  *  All rights reserved. This program and the accompanying materials
  *  are made available under the terms of the GNU Lesser Public License v2.1
  *  which accompanies this distribution, and is available at
  *  http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  *
  *  Contributors:
  *      Leibniz Institute of Plant Genetics and Crop Plant Research (IPK), Gatersleben, Germany - RMI Client, FileChooser and WebDAV
 */
package de.ipk_gatersleben.bit.bi.edal.publication.metadata;
public class FileProgressMonitor {
	private int max;

Constructs a graphic object that shows progress, typically by filling in a rectangular bar as the process nears completion.

Parameters:
max the upper bound of the range
	public FileProgressMonitor(JProgressBar fileProgressBarint max) {
		this. = max;
		this. = fileProgressBar;
	}

Indicate the progress of the operation being monitored. If the specified value is >= the maximum, the progress monitor is closed.

Parameters:
newValue an int specifying the current value, between the maximum and minimum specified for this component
	public void setProgress(final int newValue) {
		if (newValue >= ) {
else if (this. != null) {
			try {
				// if (sun.awt.AppContext.getAppContext() == null) {
				// sun.awt.SunToolkit.createNewAppContext();
				// }
				SwingUtilities.invokeAndWait(new Runnable() {
					public void run() {
						.setValue((int) Math.ceil(100.0 / 
newValue));
					}
				});
catch (Exception e) {
			}
		}
	}

Indicate that the operation is complete. This happens automatically when the value set by setProgress is >= max, but it may be called earlier if the operation ends early.
	public void close() {
	}

Returns the maximum value -- the higher end of the progress value.

Returns:
an int representing the maximum value
See also:
setMaximum(int)
	public int getMaximum() {
		return ;
	}

Specifies the maximum value.

Parameters:
m an int specifying the maximum value
See also:
getMaximum()
	public void setMaximum(int m) {
		if ( != null) {
		}
		 = m;
	}
New to GrepCode? Check out our FAQ X