當前位置: 首頁>>代碼示例>>Java>>正文


Java SwingWorker.isCancelled方法代碼示例

本文整理匯總了Java中javax.swing.SwingWorker.isCancelled方法的典型用法代碼示例。如果您正苦於以下問題:Java SwingWorker.isCancelled方法的具體用法?Java SwingWorker.isCancelled怎麽用?Java SwingWorker.isCancelled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.SwingWorker的用法示例。


在下文中一共展示了SwingWorker.isCancelled方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: run

import javax.swing.SwingWorker; //導入方法依賴的package包/類
public static boolean run(SwingWorker<?,?> worker, Frame parent) throws Exception {
	ProgressDialog dialog = new ProgressDialog(parent, worker);
	worker.execute();
	dialog.setVisible(true);
	try {
		worker.get();
	}
	catch (ExecutionException e) {
		if (e.getCause() instanceof CancellationException) {
			return false;
		} else if (e.getCause() instanceof Exception) {
			throw (Exception)e.getCause();
		} else {
			// ?!?
			throw new AssertionError(e);
		}
	}
	
	return !worker.isCancelled();
}
 
開發者ID:mgropp,項目名稱:pdfjumbler,代碼行數:21,代碼來源:ProgressDialog.java

示例2: loadRawDataFile

import javax.swing.SwingWorker; //導入方法依賴的package包/類
/**
 *
 *
 * @param loadDataTask the value of loadDataTask
 * @param usingFullPropagation the value of usingFullPropagation
 * @param leftShadeCount the value of leftShadeCount
 * @param ignoreFirstFractions the value of ignoreFirstFractions
 * @param inLiveMode the value of inLiveMode
 * @return the
 * java.util.SortedSet<org.earthtime.Tripoli.fractions.TripoliFraction>
 */
@Override
protected SortedSet<TripoliFraction> loadRawDataFile(//
        SwingWorker loadDataTask, boolean usingFullPropagation, int leftShadeCount, int ignoreFirstFractions, boolean inLiveMode) {

    SortedSet myTripoliFractions = new TreeSet<>();
    loadDataTask.firePropertyChange("progress", 10, 33);

    try {
        List<org.cirdles.calamari.shrimp.ShrimpFractionExpressionInterface> myShrimpFractions = null;

        PrawnFileHandler prawnFileHandler = new org.cirdles.calamari.core.PrawnFileHandler();
        myShrimpFractions = prawnFileHandler.extractShrimpFractionsFromPrawnFile(//"ILC-III-9peak-bkg3.xml", true, false);   //
                "https://raw.githubusercontent.com/bowring/XSD/master/SHRIMP/EXAMPLE_100142_G6147_10111109.43_10.33.37%20AM.xml", true, false, "T");

        // send name to project
        loadDataTask.firePropertyChange("projectName", "", myShrimpFractions.get(0).getNameOfMount());

        // assume we are golden   
        for (int f = ignoreFirstFractions; f < myShrimpFractions.size(); f++) {

            if (loadDataTask.isCancelled()) {
                break;
            }

            loadDataTask.firePropertyChange("progress", 33, 33 + ((67 * f) / myShrimpFractions.size()));

            TripoliFraction tripoliFraction = processRunFraction((org.cirdles.calamari.shrimp.ShrimpFraction)myShrimpFractions.get(f));

            // determine if standard reference material
            myTripoliFractions.add(tripoliFraction);

        } // end of files loop

        if (myTripoliFractions.isEmpty()) {
            myTripoliFractions = null;
        }

    } catch (JAXBException | IOException | SAXException readingException) {
        JOptionPane.showMessageDialog(
                null,
                new String[]{"Selected Prawn file does not conform to schema."},
                "ET Redux Warning",
                JOptionPane.WARNING_MESSAGE);
    }
    return myTripoliFractions;
}
 
開發者ID:CIRDLES,項目名稱:ET_Redux,代碼行數:58,代碼來源:ShrimpFileHandler.java


注:本文中的javax.swing.SwingWorker.isCancelled方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。