+ 1

Help pls.. How do you make it so when click then close button (x), it will prompt again until you click the Yes button?

int answer = JOptionPane.showConfirmDialog( null, message, title, JOptionPane.YES_NO_OPTION); if ( answer == JOption.YES_OPTION) { JOptionPane.ShowMessageDialog(null, "null, msg, title, JOptionPane.YES_OPTION); } else if ( answer == JOption.NO_OPTION) { JOptionPane.ShowMessageDialog(null, "null, msg, title, JOptionPane.NO_OPTION); } else JOptionPane.ShowMessageDialog(null, msg, title, JOptionPane..CLOSE_OPTION); }}

2nd Mar 2018, 9:08 AM
Mark glenn
Mark glenn - avatar
4 Antworten
0
put ur code in a while loop not if. copy ur code in playground and send it's link if u need more help
2nd Mar 2018, 9:53 AM
Farshaad Heydari
Farshaad Heydari - avatar
+ 12
variable answer can have two values either 0 or 1 , so why not in if() statement ... comparision be done with either 0 or 1
2nd Mar 2018, 9:20 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 1
thanks guys! I finish it now. :)
2nd Mar 2018, 10:09 AM
Mark glenn
Mark glenn - avatar
0
👍
2nd Mar 2018, 10:19 AM
Farshaad Heydari
Farshaad Heydari - avatar