run() メソッド内のコードは実行されていません。誰でも理由を教えてもらえますか?
startButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
if(creator == null) {
String[] args = getArguments();
try {
writeSettingsFile(args);
} catch(IOException io) {}
consolePanel.addLine("Starting...");
bar.setIndeterminate(true);
try {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
MessageConsole console = new MessageConsole(getConsole().getTextPane(), self, null);
console.redirectOut(new Color(240, 240, 240), null);
console.redirectErr(Color.RED, null);
console.setMessageLines(consolePanel.getHeight() / 17);
try {
SomeApp.main(getArguments());
} catch (Exception ex) {
Logger.getLogger(OSXWorldPanel.class.getName()).log(Level.SEVERE, null, ex);
}
}
});
} catch (InterruptedException ex) {
Logger.getLogger(OSXWorldPanel.class.getName()).log(Level.SEVERE, null, ex);
} catch (InvocationTargetException ex) {
Logger.getLogger(OSXWorldPanel.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
});
エラーをスローします:
Exception in thread "AWT-EventQueue-0" java.lang.Error: Cannot call invokeAndWait from the event dispatcher thread
at java.awt.EventQueue.invokeAndWait(EventQueue.java:1017)
at javax.swing.SwingUtilities.invokeAndWait(SwingUtilities.java:1320)