我使用下面的代码来创建一个选项对话框。
String[] options = { "Confirm", "Cancel" };
int selected = JOptionPane.showOptionDialog(
parent, "Confirm Trade","Confirmation", JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE, null, options, options[0]);