本文整理汇总了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();
}
示例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;
}