当前位置: 首页>>代码示例>>Java>>正文


Java ProgressMonitor.setMaximum方法代码示例

本文整理汇总了Java中javax.swing.ProgressMonitor.setMaximum方法的典型用法代码示例。如果您正苦于以下问题:Java ProgressMonitor.setMaximum方法的具体用法?Java ProgressMonitor.setMaximum怎么用?Java ProgressMonitor.setMaximum使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.ProgressMonitor的用法示例。


在下文中一共展示了ProgressMonitor.setMaximum方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addFrames

import javax.swing.ProgressMonitor; //导入方法依赖的package包/类
/** Add all the frames from an AnimationReader.
 * 
 * @param r the animation to read.
 * @param monitor an optional ProgressMonitor to update
 * @throws IOException if an error occurs copying frames.
 */
public void addFrames(AnimationReader r, ProgressMonitor monitor) throws IOException {
	if(monitor!=null)
		monitor.setMaximum(r.getFrameCount());
	BufferedImage bi = r.getNextFrame(false);
	int ctr = 1;
	while(bi!=null) {
		if(monitor!=null) {
			if(monitor.isCanceled()) {
				throw new UserCancelledException();
			}
			monitor.setProgress(ctr);
		}
		float d;
		try {
			d = (float)r.getFrameDuration();
		} catch(Exception e) {
			e.printStackTrace();
			d = 1;
		}
		addFrame(d, bi, .98f);
		bi = r.getNextFrame(false);
		ctr++;
	}
}
 
开发者ID:mickleness,项目名称:pumpernickel,代码行数:31,代码来源:JPEGMovWriter.java

示例2: doInBackground

import javax.swing.ProgressMonitor; //导入方法依赖的package包/类
@Override
public Void doInBackground() {
	String rawString = configManager.getRawString();
	try {
		stream = new ProgressMonitorInputStream(null, (Object) "Flashing",
				new ByteArrayInputStream(rawString
						.getBytes(HacklaceConfigManager.HACKLACE_CHARSET)));
		ProgressMonitor progressMonitor = stream.getProgressMonitor();
		progressMonitor.setMaximum(rawString.length());
		progressMonitor.setProgress(0);
		progressMonitor.setMillisToPopup(0);
		animatorGui.setCursor(Cursor
				.getPredefinedCursor(Cursor.WAIT_CURSOR));
		flashExporter.write(stream);
	} catch (Exception ex) {
		JOptionPane.showMessageDialog(null, "Error flashing hacklace: "
				+ ex, "Error", JOptionPane.ERROR_MESSAGE);
	}
	return null;
}
 
开发者ID:Twissi,项目名称:Animator,代码行数:21,代码来源:FlashThread.java

示例3: MyGrabber

import javax.swing.ProgressMonitor; //导入方法依赖的package包/类
MyGrabber(ProgressMonitor monitor, Image image, int x, int y, int width, int height, int[] values, int start,
		int scan) {
	super(image, x, y, width, height, values, start, scan);
	this.monitor = monitor;
	progress = 0;
	goal = width * height;
	monitor.setMinimum(0);
	monitor.setMaximum(goal * 21 / 20);
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:10,代码来源:GifEncoder.java

示例4: getProgressMonitorInputStream

import javax.swing.ProgressMonitor; //导入方法依赖的package包/类
public InputStream getProgressMonitorInputStream(InputStream in, int length, String msg) {
    ProgressMonitorInputStream pmin = new ProgressMonitorInputStream(parent, msg, in);
    ProgressMonitor pm = pmin.getProgressMonitor();

    if (length > 0)
        pm.setMaximum(length);
    return pmin;
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:9,代码来源:AbstractSwingGuiCallback.java

示例5: MyGrabber

import javax.swing.ProgressMonitor; //导入方法依赖的package包/类
MyGrabber(ProgressMonitor monitor, Image image, int x, int y,
		int width, int height, int[] values, int start, int scan) {
	super(image, x, y, width, height, values, start, scan);
	this.monitor = monitor;
	progress = 0;
	goal = width * height;
	monitor.setMinimum(0);
	monitor.setMaximum(goal * 21 / 20);
}
 
开发者ID:reds-heig,项目名称:logisim-evolution,代码行数:10,代码来源:GifEncoder.java

示例6: MyGrabber

import javax.swing.ProgressMonitor; //导入方法依赖的package包/类
MyGrabber(ProgressMonitor monitor, Image image, int x, int y, int width, int height,
		int[] values, int start, int scan) {
	super(image, x, y, width, height, values, start, scan);
	this.monitor = monitor;
	progress = 0;
	goal = width * height;
	monitor.setMinimum(0);
	monitor.setMaximum(goal * 21 / 20);
}
 
开发者ID:franciscaconcha,项目名称:ProyectoLogisim,代码行数:10,代码来源:GifEncoder.java

示例7: doImportTraitsFileImpl

import javax.swing.ProgressMonitor; //导入方法依赖的package包/类
private void doImportTraitsFileImpl(File file) {
	Context context = KDSmartApplication.getInstance();
	final ProgressMonitor monitor = new ProgressMonitor(TraitExplorerPanel.this, "Loading", "", 0, 100);
	ProgressReporter progressReporter = new ProgressReporter() {

		@Override
		public void setProgressNote(String note) {
			monitor.setNote(note);
		}

		@Override
		public void setProgressMaximum(int max) {
			monitor.setMaximum(max);
		}

		@Override
		public void setProgressCount(int count) {
			monitor.setProgress(count);
		}

		@Override
		public void dismissProgress() {
			monitor.close();
		}
	};

	try {
		Either<ImportError, TraitImportTransactions> either = offlineData.getKdxploreDatabase()
				.getKDXploreKSmartDatabase().importTraitsFile(context, file, progressReporter);

		if (either.isLeft()) {
			ImportError ie = either.left();
			MsgBox.error(TraitExplorerPanel.this, ie.getMessage("Import Traits"), "Import Failed");
		} else {
			TraitImportTransactions tit = either.right();

			if (!tit.traitsToBeUpdated.isEmpty()) {

			}

			refreshTraitsTable();

			StringBuilder sb = new StringBuilder("Import Result");
			if (tit.nSkipped > 0) {
				sb.append("\nSkipped ").append(tit.nSkipped);
			}
			if (!tit.traitsToBeAdded.isEmpty()) {
				sb.append("\nAdded: ").append(tit.traitsToBeAdded.size());
			}
			if (!tit.traitsToBeUpdated.isEmpty()) {
				sb.append("\nUpdated: ").append(tit.traitsToBeUpdated.size());
			}
			MsgBox.info(TraitExplorerPanel.this, sb.toString(), "Import Complete");
		}
	} finally {
		progressReporter.dismissProgress();
	}
}
 
开发者ID:kddart,项目名称:kdxplore,代码行数:59,代码来源:TraitExplorerPanel.java

示例8: ParallelCoordinatesChart

import javax.swing.ProgressMonitor; //导入方法依赖的package包/类
/**
 * Instantiates a new parallel coordinates chart.
 * 
 * @param dataSheet
 *            the data sheet
 * @param progressMonitor 
 * 			the progress monitor
 * @param id 
 * 				the id
 */
public ParallelCoordinatesChart(DataSheet dataSheet, ProgressMonitor progressMonitor, int id) {
	super(dataSheet, id);
	this.setLocation(new Point(100, 100));
	this.setFrameSize(new Dimension(1280, 800));
	log("constructor called. Read Base settings.");
	UserPreferences userPreferences = UserPreferences.getInstance();
	this.backGroundColor = userPreferences.getParallelCoordinatesDefaultBackgroundColor();
	this.showDesignIDs = userPreferences.isParallelCoordinatesShowDesignIDs();
	this.showFilteredDesigns = userPreferences.isParallelCoordinatesShowFilteredDesigns();
	this.verticallyOffsetAxisLabels = userPreferences.isParallelCoordinatesVerticallyOffsetAxisLabels();
	this.setActiveDesignColor(userPreferences.getParallelCoordinatesActiveDesignDefaultColor());
	this.selectedDesignColor = userPreferences.getParallelCoordinatesSelectedDesignDefaultColor();
	this.setFilteredDesignColor(userPreferences.getParallelCoordinatesFilteredDesignDefaultColor());
	this.designLabelFontSize = userPreferences.getParallelCoordinatesDesignLabelFontSize();
	this.lineThickness = userPreferences.getParallelCoordinatesLineThickness();
	this.selectedDesignsLineThickness = userPreferences.getParallelCoordinatesSelectedDesignLineThickness();
	this.filterColor = userPreferences.getParallelCoordinatesFilterDefaultColor();
	this.showOnlySelectedDesigns = userPreferences.isParallelCoordinatesShowOnlySelectedDesigns();
	this.filterHeight = userPreferences.getParallelCoordinatesFilterHeight();
	this.filterWidth = userPreferences.getParallelCoordinatesFilterWidth();
	log("constructor: Base settings read. Creating axes...");
	progressMonitor.setMaximum(dataSheet.getParameterCount() - 1);
	progressMonitor.setNote("Building Chart...");
	for (int i = 0; i < dataSheet.getParameterCount() && !progressMonitor.isCanceled(); i++) {
		// log("constructor: Creating axis "+dataSheet.getParameter(i).getName());
		Axis newAxis = new Axis(dataSheet, this, dataSheet.getParameter(i));
		this.addAxis(newAxis);
		progressMonitor.setProgress(i);
	}

	if (!progressMonitor.isCanceled()) {
		progressMonitor.setNote("Building Filters...");
		progressMonitor.setProgress(0);
		// log("constructor: axes created. Creating filters...");
		for (int i = 0; i < dataSheet.getParameterCount() && !progressMonitor.isCanceled(); i++) {
			this.axes.get(i).addFilters();
			progressMonitor.setProgress(i);
		}
		// log("constructor: filters created. ");
	}

}
 
开发者ID:enguerrand,项目名称:xdat,代码行数:53,代码来源:ParallelCoordinatesChart.java

示例9: importData

import javax.swing.ProgressMonitor; //导入方法依赖的package包/类
/**
 * Fills the DataSheet with data from a given file and assigns Parameter
 * names.r
 * <p>
 * If dataHasHeaders is true, the Parameter names are read from the first
 * line. Otherwise the parameter names are created automatically.
 * 
 * @param pathToInputFile
 *            the path to the input file
 * @param dataHasHeaders
 *            specifies whether the data has headers to read the Parameter
 *            names from.
 * @param progressMonitor
 *            the progress monitor.
 * @throws IOException
 *             Signals that an I/O exception has occurred.
 */
private void importData(String pathToInputFile, boolean dataHasHeaders, ProgressMonitor progressMonitor) throws IOException {
	Vector<Design> buffer = new Vector<Design>(0, 1);
	if (this.data != null) {
		buffer = (Vector<Design>) this.data.clone();
	}
	int lineCount = getLineCount(pathToInputFile);
	progressMonitor.setMaximum(lineCount);

	BufferedReader f;
	String line;
	int idCounter = 1;
	f = new BufferedReader(new FileReader(pathToInputFile));
	line = (f.readLine()).trim();

	String[] lineElements = line.split(this.delimiter);
	if (dataHasHeaders) // if data has headers read the parameter names from
						// the first line
	{
		for (int i = 0; i < lineElements.length; i++) {
			this.parameters.add(new Parameter(this.getUniqueParameterName(lineElements[i]), this));
		}
	} else // if data does not have headers read the first Design from the first line and create default Parameter names
	{
		Design newDesign = new Design(idCounter++);
		for (int i = 0; i < lineElements.length; i++) {
			this.parameters.add(new Parameter("Parameter " + (i + 1), this));
			newDesign.setValue(this.parameters.get(i), lineElements[i]);

		}
		this.data.add(newDesign);
		this.designIdsMap.put(newDesign.getId(), newDesign);
		progressMonitor.setProgress(idCounter - 1);
	}
	try {
		readDesignsFromFile(progressMonitor, f, idCounter);
	} catch (IOException e) {

		this.data = buffer;
		throw e;
	}
	f.close();
	if (progressMonitor.isCanceled()) {
		this.data = buffer;
	}

	// this loop ensures that all discrete levels are known to the parameter
	// so it returns the right double values
	for (int i = 0; i < this.parameters.size(); i++) {
		if (!this.parameters.get(i).isNumeric()) {
			this.parameters.get(i).getMaxValue();
		}
	}
}
 
开发者ID:enguerrand,项目名称:xdat,代码行数:71,代码来源:DataSheet.java

示例10: loadVenueData

import javax.swing.ProgressMonitor; //导入方法依赖的package包/类
public Vector loadVenueData(Component parent) throws Exception {

		headers = null;
		Socket s = null;
		ProgressMonitor progress = null;
		Vector venues = null;

		try
		{
			StallInputStream stallInput = new StallInputStream();

			ProgressMonitorInputStream pmis = new ProgressMonitorInputStream(
					parent, "Loading filter data from pente.org", stallInput);
			progress = pmis.getProgressMonitor();
            progress.setNote("Connecting to pente.org...");
			progress.setMillisToDecideToPopup(1);
            progress.setMillisToPopup(1);
            progress.setMaximum(15000);

			StringBuffer paramsBuffer = new StringBuffer();
	        StringBuffer requestBuffer = createHttpRequest(paramsBuffer, "/venues");

	        int len = 0;

        	s = getHttpResponseSocket(requestBuffer);
        	progress.setProgress(2000);
            progress.setNote("Downloading from pente.org...");

            // read past the http headers to the data
            InputStream in = s.getInputStream();
            String contentLength = getHeader("content-length:", in);
            if (contentLength != null) {
            	len = Integer.parseInt(contentLength);
            }
//            for (int i = 0; i < len; i++) {
//            	int b = in.read();
//            	if (b == -1) {
//            		System.out.println("error");
//            	}
//            }

        	progress.setMaximum(len);
        	stallInput.setInputStream(in);

        	ObjectInputStream objectIn = new ObjectInputStream(pmis);
			venues = (Vector) objectIn.readObject();

        } catch (Exception e) {
        	if (s != null) {
        		s.close();
            	s = null;
        	}
			if (!(e instanceof InterruptedException) && !(progress == null || !progress.isCanceled())) {
				throw e;
			}
        }

        return venues;
	}
 
开发者ID:dweebo,项目名称:pentedb,代码行数:60,代码来源:PlunkHttpLoader.java

示例11: translate

import javax.swing.ProgressMonitor; //导入方法依赖的package包/类
/**
 * Change the IMC definitions of a given LSF file, generates a new one
 * @param originalDir The folder of the original LSF file
 * @param destinationDir The destination folder, containing the new IMC definitions
 * @param messagesToFilter Messages to filtered out (optional)
 * @param m ProgressMonitor to be updated according to the progress of this process (optional)
 * @throws Exception In case some file cannot be read / written to.
 */
public static void translate(File originalDir, File destinationDir, Vector<String> messagesToFilter, ProgressMonitor m) throws Exception {

    if (m != null)
        m.setMaximum(100);
    
    if (messagesToFilter == null)
        messagesToFilter = new Vector<String>();
    
    LsfIndex index = new LsfIndex(new File(originalDir, "Data.lsf"));

    IMCDefinition destDefs = new IMCDefinition(new FileInputStream(new File(destinationDir, "IMC.xml")));

    FileOutputStream fos = new FileOutputStream(new File(destinationDir, "Data.lsf"));
    int lastPercent = -1;

    System.out.println("Translating from "+originalDir+" to "+destinationDir);
    for (int i = 0; i < index.getNumberOfMessages(); i++) {
        
        if (messagesToFilter.contains(index.getDefinitions().getMessageName(index.typeOf(i))))
            continue;
        
        IMCMessage original = index.getMessage(i);

        if (!destDefs.messageExists(original.getAbbrev())) {
            System.err.println("Dropping message "+original.getAbbrev()+" because it doesn't exists in destination IMC.");
            continue;
        }

        IMCMessage result = original.cloneMessage(destDefs);
        destDefs.serialize(result, fos);
        int percent = (i*100 / index.getNumberOfMessages());
        if (percent != lastPercent) {
            if (m != null) {
                m.setNote(percent+"% done...");
                m.setProgress(percent);
            }
            else
                System.out.println(percent+"% done...");
            
            lastPercent = percent;
        }

    }
    if (m != null)
        m.close();
    fos.close();
}
 
开发者ID:LSTS,项目名称:imcjava,代码行数:56,代码来源:LsfUtils.java


注:本文中的javax.swing.ProgressMonitor.setMaximum方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。