当我的doInBackground
(SwingWorker的方法)返回null
(意思是当我的任务完成时),我想停止进度条的不确定模式。这里是我的代码里面的按钮;当我运行我的代码时,出现错误。下面是代码:在SwingWorker中停止JProgressBar的不确定模式
private void StartButtonMouseClicked(java.awt.event.MouseEvent evt) {
final Main f22 = new Main();
initializer();
f22.getfile(FileName, 0);
f22.execute();
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
jProgressBar1.setIndeterminate(true);
try {
if (f22.doInBackground() == null) {
jProgressBar1.setIndeterminate(false);
}
} catch (IOException ex) {
Logger.getLogger(GUI.class.getName()).log(Level.SEVERE, null, ex);
}
}
});
这里是我的错误:
# # A fatal error has been detected by the Java Runtime Environment: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6e1b0750, pid=4988, tid=5464 # # JRE version: 7.0-b141 # Java VM: Java HotSpot(TM) Client VM (21.0-b11 mixed mode, sharing windows-x86 # Problematic frame: # V [jvm.dll+0xa0750] # # Failed to write core dump. Minidumps are not enabled by default on client versions of Windows #
参见[* JProgressBar的卸下*的不确定模式](http://stackoverflow.com/questions/10656658/removing-the-indeterminate-mode-of-jprogressbar)。 – trashgod