How to dispose the JFrame
after few sec and go to other JFrame
? I had tried to put the this.dispose()
but it did not work and still not dispose it.
Below will show where I had placed the dispose method.
int good = 3 ;
public Dloading2() {
this.getContentPane().setBackground(Color.white);
initComponents();
Timer timer = new Timer();
TimerTask task = new TimerTask()
{
public void run()
{
if(good == 3)
{
ConfirmationDeposit cust = new ConfirmationDeposit();
cust.setVisible(true);
//this.dispose();
cancel();
}
}
};
timer.scheduleAtFixedRate(task, 3000, 1000);
}