I use this line to show my ConfirmDialog
JavaScript
x
int yn = JOptionPane.showConfirmDialog(frame.getParent(), scrollPane, "stuffs",
JOptionPane.OK_CANCEL_OPTION);
In that ConfirmDialog I have a button which calls a server using a actionListener, when the connection is broken I have a check which terminates the function. But i can for the love of god not figure out how to terminate the ConfirmDialog at the same time.
How can I solve this problem while still using ConfirmDialog?
Advertisement
Answer
You could use setVisible(false) or dispose() method
JavaScript
JOptionPane pane=newJOptionPane(frame.getParent(),scrollPane,"stuffs",JOptionPane.OK_CANCEL_OPTION);
pane.dispose(); //or pane.setVisible(false);