actually i have called the swing worker from a frame (Suppose) A.. in the swing worker class in do-in-Background method i have certain db queries and i am calling frame B too.. in the done() method however i want to dispose the frame A.. how can i do that..? i cannot write dispose() in frame A class because that results in disposing of frame before the new frame(frame B) is visible... Please help!!
class frameA extends JFrame{
public frameA(){
//done some operations..
SwingWorker worker=new Worker();
worker.execute();
}
public static void main(string[] args){
new frameA();
}
}
and in worker class
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
}