I have a JDialg for showing the progress of a certain task. To display and hide the dialog box I have following methods,
public class ProgressDisplayer extends javax.swing.JDialog {
......
public void s_show() {
this.setTitle("Month End Status");
setModal(true);
setResizable(false);
pack();
this.setLocationRelativeTo(null);
this.setVisible(true);
}
public void s_hide() {
this.dispose();
}
...........
}
When I try to close this JDialog box from a Thread as below, although it is displayed properly yet I cannot hide it when I call pd.s_hide()
method.
...........
public void run() {
ProgressDisplayer pd = new ProgressDisplayer();
pd.s_show();
Thread.sleep(1000);
pd.s_hide();
}
.............
please assist me.