I have a dialog for a client-GUI that asks for the IP and Port of the server one wants to connect to. I have everything else, but how would I make it so that when the user c
I'd suggest to use showConfirmDialog
instead
int result = JOptionPane.showConfirmDialog(myParent, "Narrative",
"Title", JOptionPane.INFORMATION_MESSAGE);
and there you can test for various returns value from JDialog/JOptionPane
if (result == JOptionPane.OK_OPTION,
JOptionPane.CANCEL_OPTION,
JOptionPane.CLOSED_OPTION, etc..