|
![]() |
||||||
UIDefaults defaults = UIManager.getDefaults ();
defaults.put ("OptionPane.yesButtonText", "Computer plays first");
defaults.put ("OptionPane.noButtonText", "Human plays first");
defaults.put ("OptionPane.cancelButtonText", "Not now dear, I have a headache");
int x = JOptionPane.showConfirmDialog (null, null, null, JOptionPane.YES_NO_CANCEL_OPTION);
switch (x) {
case JOptionPane.YES_OPTION:
System.out.println("Computer first");
break;
case JOptionPane.NO_OPTION:
System.out.println("Human first");
break;
case JOptionPane.CANCEL_OPTION:
System.out.println("Not now, dear");
break;
}
|
![]() ![]() ![]() ![]() ![]() Sign up for free
|