如何在不创建新子类SwingWorker的情况下重用子类SwingWorker,并更改DoInBackround()以打开不同的JFrame / JDialog?
class Loading extends SwingWorker<Void, Void> {
@Override
@SuppressWarnings("Convert2Lambda")
public Void doInBackground() throws InterruptedException {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
d.setVisible(true);
new Taxi_Summary().setVisible(true);
//here i want to open a new JFrames/JDialogs when a button is pressed
}
});
Thread.sleep(2000);//2000 millis = 2 seconds
return null;
}
@Override
public void done() {
d.dispose();
}
}