int r = JOptionPane.showOptionDialog(null,
myPanel,
"Choose",
JOptionPane.NO_OPTION,
JOptionPane.PLAIN_MESSAGE,
null,
new String[]{}, // this is the array
"default");
How do you catch the event when the user has clicked the X to close the dialog?
From the documentation:
I believe you are looking for the
CLOSED_OPTIONone.