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


Java ProgressMonitor类代码示例

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


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

示例1: opt

import javax.swing.ProgressMonitor; //导入依赖的package包/类
private void opt (SolverState solverState) {
		
		new Thread() {
			@Override
			public void run() {
				
				File result = new File (Tweed.SCRATCH + "solver_state.xml");
				SkelFootprint.solve( solverState, new ProgressMonitor( null, "optimising", result.getName(), 0, 100 ), 
						result, Long.MAX_VALUE );

				SkelFootprint.postProcesss( solverState );
				
//				profileGen.tweed.frame.removeGens( SkelGen.class );
				profileGen.tweed.frame.addGen( new SkelGen( solverState.mesh, profileGen.tweed, profileGen.blockGen ), true );
			}
		}.start();
	}
 
开发者ID:twak,项目名称:chordatlas,代码行数:18,代码来源:SSBuilder.java

示例2: statusBarBegin

import javax.swing.ProgressMonitor; //导入依赖的package包/类
/**
 * statusBarBegin.
 *
 * @param progress          Progress
 * @param message           String
 * @param activityMonitored String
 */
public void statusBarBegin(final Progress progress, final String message,
                           final String activityMonitored) {
    BusyIndicator.showAt(Application.instance().getActiveWindow().getControl());
    task = new LongTask();
    task.setActivityMonitored(activityMonitored);
    task.setProgress(progress);

    timer.addActionListener(new TimerListener());

    progressMonitor =
            new ProgressMonitor(this.getControl(), message, "Preparing the " + "operation...",
                    0, 1);
    progressMonitor.setMillisToDecideToPopup(ONE_SECOND);
    task.setMonitor(progressMonitor);

    task.go();
    timer.start();
}
 
开发者ID:pan-dora,项目名称:modeller,代码行数:26,代码来源:BagView.java

示例3: 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

示例4: actionPerformed

import javax.swing.ProgressMonitor; //导入依赖的package包/类
/**
    * Invoked when the user presses the start button.
    */
   public void actionPerformed(ActionEvent evt) {
progressMonitor = new ProgressMonitor(
	FileTransferProgressMonitorDemo.this, "Uploads a file...", "",
	0, 100);
progressMonitor.setProgress(0);

Thread t = new Thread() {
    public void run() {
	doFileUpload();
    }
};

t.start();

task = new Task();
task.addPropertyChangeListener(this);
task.execute();
startButton.setEnabled(false);

   }
 
开发者ID:kawansoft,项目名称:awake-file,代码行数:24,代码来源:FileTransferProgressMonitorDemo.java

示例5: actionPerformed

import javax.swing.ProgressMonitor; //导入依赖的package包/类
/**
    * Invoked when the user presses the start button.
    */
   public void actionPerformed(ActionEvent evt) {
progressMonitor = new ProgressMonitor(
	FileTransferProgressMonitorDownloadDemo.this,
	"Downloads a file...", "", 0, 100);
progressMonitor.setProgress(0);

Thread t = new Thread() {
    public void run() {
	doFileDownload();
    }
};

t.start();

task = new Task();
task.addPropertyChangeListener(this);
task.execute();
startButton.setEnabled(false);

   }
 
开发者ID:kawansoft,项目名称:awake-file,代码行数:24,代码来源:FileTransferProgressMonitorDownloadDemo.java

示例6: RanksResult

import javax.swing.ProgressMonitor; //导入依赖的package包/类
public RanksResult(JFrame parent,Ranks ranks,int bestNRanks,boolean ascendant){

		super(parent,true);
		//this.parent=parent;
		this.bestNRanks=bestNRanks;
		this.ranks=ranks;
		this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);

		this.factorCompare=ascendant?-1:1;
		this.maxJump=ranks.getMaxJump();
		this.stackWidth=ranks.getStackWidth();
		progressMonitor=new ProgressMonitor(parent,AIRanksTool.getUIText("Result_Progress_Message"),"",0,100);
		progressMonitor.setProgress(0);
		task = new Task();
        task.addPropertyChangeListener(this);
        task.execute();

	}
 
开发者ID:PoochyEXE,项目名称:nullpomino,代码行数:19,代码来源:RanksResult.java

示例7: cutSurface

import javax.swing.ProgressMonitor; //导入依赖的package包/类
/**
 * Cut the given surface with this CutPoint.
 *
 * @param surface Surface
 * @param monitor progress monitor which can be canceled
 */
@Override
public synchronized void cutSurface(Surface surface, ProgressMonitor monitor) {
  Vector2d cutVectorS = getPerpVector(cutDepth);
  double x0 = getX() + cutVectorS.x;			// cutter location with depth
  double z0 = getZ() + cutVectorS.y;

  int nSectors = surface.numSectors();		// number of sectors around shape
  double dAngle = 360.0 / (double) nSectors;	// angle increment degrees

  Vector2d cutXZ;						// Location of center of cutter
  double spindleC, lastC = 0.0;		// rotation in degrees
  int count;
  for (count = 0, spindleC = 0.0; count < nSectors; count++, spindleC += dAngle) {
    cutXZ = rosetteMove(spindleC, x0, z0);
    surface.rotateZ(spindleC - lastC);		// incremental rotate the surface
    if (cutter.canFastRender()) {
      surface.cutSurface(cutter, cutXZ.x, cutXZ.y, spindleC);
    } else {
      surface.cutSurface(cutter, cutXZ.x, cutXZ.y);
    }
    lastC = spindleC;
  }
  surface.rotateZ(360.0 - lastC);		// bring it back to the starting point
}
 
开发者ID:billooms,项目名称:COrnLathe,代码行数:31,代码来源:RosettePoint.java

示例8: cutSurface

import javax.swing.ProgressMonitor; //导入依赖的package包/类
/**
 * Cut the given surface with this CutPoint.
 *
 * @param surface Surface
 * @param monitor progress monitor which can be canceled
 */
@Override
public synchronized void cutSurface(Surface surface, ProgressMonitor monitor) {
  Vector2d cutVectorS = getMoveVector(cutDepth);	// cut direction scaled by depth
  double cutX = getX() + cutVectorS.x;
  double cutZ = getZ() + cutVectorS.y;

  int nSamples = surface.numSectors();
  double spindleC, lastC = 0.0;
  for (int i = 0; i < nSamples; i++) {
    spindleC = 360.0 * (double) i / (double) nSamples;
    surface.rotateZ(spindleC - lastC);		// incremental rotate the surface
    surface.cutSurface(cutter, cutX, cutZ, spindleC);   // fast cut rendering
    lastC = spindleC;
  }
  surface.rotateZ(360.0 - lastC);		// bring it back to the starting point
}
 
开发者ID:billooms,项目名称:COrnLathe,代码行数:23,代码来源:PiercePoint.java

示例9: 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

示例10: init

import javax.swing.ProgressMonitor; //导入依赖的package包/类
public void init(int op, String src, String dest, long max) {
    this.max = max;
    monitor = new ProgressMonitor(null,
            ((op == SftpProgressMonitor.PUT)
            ? "put" : "get") + ": " + src,
            "", 0, (int) max);
    count = 0;
    percent = -1;
    monitor.setProgress((int) this.count);
    monitor.setMillisToDecideToPopup(1000);
}
 
开发者ID:xiaoerge,项目名称:File-UI,代码行数:12,代码来源:MyProgressMonitor.java

示例11: actionPerformed

import javax.swing.ProgressMonitor; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent event) {
    String path = pathField.getText();
    if (path.trim().isEmpty()) {
        JOptionPane.showMessageDialog(this, "A file path must be selected.", "Empty File Path", JOptionPane.ERROR_MESSAGE);
        return;
    }

    File selectedFile = new File(path);
    if (selectedFile.exists()) {
        this.setVisible(false);
        int option = JOptionPane.showConfirmDialog(cliGuiCtx.getMainWindow(), "Overwrite " + path, "Overwrite?", JOptionPane.YES_NO_OPTION);
        if (option == JOptionPane.NO_OPTION) {
            this.setVisible(true);
            return;
        }
    }

    this.dispose();

    progressMonitor = new ProgressMonitor(cliGuiCtx.getMainWindow(), "Downloading " + fileName, "", 0, 100);
    progressMonitor.setProgress(0);
    downloadTask = new DownloadLogTask(selectedFile);
    downloadTask.addPropertyChangeListener(this);
    downloadTask.execute();
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:27,代码来源:DownloadServerLogDialog.java

示例12: createBackup

import javax.swing.ProgressMonitor; //导入依赖的package包/类
public void createBackup(Component c, String name, CCDate date, boolean persistent, String jccversion, String dbversion) {
	if (CCProperties.getInstance().ARG_READONLY) {
		CCLog.addInformation(LocaleBundle.getString("LogMessage.OperationFailedDueToReadOnly")); //$NON-NLS-1$
		return;
	}

	CCLog.addInformation(LocaleBundle.getString("LogMessage.BackupStarted")); //$NON-NLS-1$

	ProgressMonitor monitor = DialogHelper.getLocalPersistentProgressMonitor(c, "MainFrame.backupRunning"); //$NON-NLS-1$

	try {
		createBackupInternal(name, date, persistent, jccversion, dbversion, new ProgressCallbackProgressMonitorHelper(monitor), false);
	} catch (IOException e) {
		CCLog.addError(e);
		monitor.setProgress(monitor.getMaximum());
		monitor.close();
		return;
	}

	monitor.setProgress(monitor.getMaximum());
	monitor.close();

	CCLog.addInformation(LocaleBundle.getString("LogMessage.BackupCreated")); //$NON-NLS-1$
	CCProperties.getInstance().PROP_BACKUP_LASTBACKUP.setValue(CCDate.getCurrentDate());
}
 
开发者ID:Mikescher,项目名称:jClipCorn,代码行数:26,代码来源:BackupManager.java

示例13: export

import javax.swing.ProgressMonitor; //导入依赖的package包/类
public boolean export(OutputStream out)
        throws IOException, NoninvertibleTransformException {
    this.out = out;
    List lines = ornament.getLines();
    int nLines = lines.size(), maxProgress = nLines + 2;
    ProgressMonitor pm = new ProgressMonitor(ornament, I18n._("exporting"),
                                             null, 0, maxProgress);
    init();
    prepareStream();
    pm.setProgress(1);
    head();
    BufferedImage bg = ornament.getBackgroundTile();
    if (bg != null) background(bg);
    for (int i = 0; i != nLines && !pm.isCanceled(); ++i) {
        pm.setProgress(2+i);
        export((LinPath)lines.get(i));
    }
    pm.setProgress(2+nLines);
    postBody();
    tail();
    if (out != null) out.close();
    pm.close();
    return true;
}
 
开发者ID:IMAGINARY,项目名称:morenaments-euc,代码行数:25,代码来源:Export.java

示例14: doAction

import javax.swing.ProgressMonitor; //导入依赖的package包/类
/**
 *     @see org.mbari.awt.event.IAction#doAction()
 */
public void doAction() {
    /*
     * Show dialog for selecting a directory
     */
    int option = getChooser().showOpenDialog(queryResultsFrame);
    if (option == JFileChooser.APPROVE_OPTION) {
        action.setSaveLocation(getChooser().getSelectedFile());
        URL[] urls = getImageURLs();
        action.setUrls(urls);
        action.setProgressMonitor(
                new ProgressMonitor(queryResultsFrame,
                "Downloading images", "", 0, urls.length));
        ActionRunnable ar = new ActionRunnable(action);
        ar.start();
    }
}
 
开发者ID:hohonuuli,项目名称:vars,代码行数:20,代码来源:SaveImagesFromQueryResultsAction.java

示例15: construct

import javax.swing.ProgressMonitor; //导入依赖的package包/类
@Override
public Object construct() {

	ProgressMonitor pm = new ProgressMonitor(own, msg, "", 0, max);

	pm.setMillisToDecideToPopup(0);
	pm.setMillisToPopup(0);
	pm.setProgress(0);

	return pm;
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:12,代码来源:LoadPanel.java


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