有什么区别:
//Some code, takes a bit of time to process
(new SomeJFrame()).setVisible(true);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
(new SomeJWindow()).start();//Start a new thread
}
});
和:
class doGraphics extends SwingWorker<Void, Object> {
@Override
public Void doInBackground() {
//Some code, takes a bit of time to process
(new SomeJFrame()).setVisible(true);
return null;
}
@Override
protected void done() {
(new SomeJWindow()).start();//Start a new thread
}
}
(new doGraphics()).execute();
哪种方法更好用?