import javax.swing.JOptionPane;
public class OptionDialog {
public static void main(String[] args) {
int return = JOptionPane.showOptionDialog(null,
你确定要继续吗?”,
错误”,
//JOptionPane 是 no
JOptionPane.YES_NO_OPTION,
JOptionPane.ERROR_MESSAGE,
null, null, null);
}
}
System.exit(
0
)
:import javax.swing.JOptionPane;Result:
public class OptionDialog {
public static void main(String[] args) {
Object[] choice={18-25 years”,26-35 years”,36-45 years”,46-55 years”,56 years and older”};
int choice = JOptionPane.showOptionDialog(null,
你的年龄范围是多少?”,
年龄范围”,
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE,
null, choice, choice[0]);
}
}
Please disable your ad blocker and refresh the window to use this website.