62,567
社区成员




exit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Object[] options = { "<html>是 (<u>Y</u>)</html>", "<html>否 (<u>N</u>)</html>" };
int n = JOptionPane.showOptionDialog(null, "真的要退出吗?", "提示",
JOptionPane.YES_NO_OPTION, // 弹窗方式
JOptionPane.QUESTION_MESSAGE, // 弹窗提示类型
null, // 不使用系统图标
options, // 按钮内容
options[1] // 设置默认按钮
);
if (n == JOptionPane.YES_OPTION) {
System.exit(0);
} else {
//...
}
}
});