实际上我已经从框架(假设)A中调用了swing工作者。在do-in-Background方法的swing工作者类中我有某些数据库查询,我也在调用框架B..在done()方法中但是我想处置框架 A.. 我该怎么做..?我不能在框架 A 类中编写 dispose(),因为这会导致在新框架(框架 B)可见之前处理框架......请帮助!
class frameA extends JFrame{
public frameA(){
//done some operations..
SwingWorker worker=new Worker();
worker.execute();
}
public static void main(string[] args){
new frameA();
}
}
在工人阶级
class Worker extends SwingWorker<Void, String> {
public Worker() {
super();
}
//Executed on the Event Dispatch Thread after the doInBackground method is finished
@Override
protected void done() {
//want to dispose the frameA here..
}
@Override
protected Void doInBackground() throws Exception {
// some db queries
new frameB().setVisible(true);
// call to frameb
}