String s1 = "Quit";
String s2 = "Cancel";
Object[] options = {s1, s2};
int n = JOptionPane.showOptionDialog(frame,
"Windows are still open.\nDo you really want to quit?",
"Quit Confirmation",
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE,
null,
options,
s1);
if (n == JOptionPane.YES_OPTION) {
return true;
} else {
return false;
}