Kas*_*inn 8 java swing jbutton joptionpane
我想将YES和NO改为同意/不同意.我该怎么办?
int reply = JOptionPane.showConfirmDialog(null,
"Are you want to continue the process?",
"YES?",
JOptionPane.YES_NO_OPTION);
Run Code Online (Sandbox Code Playgroud)
Ani*_*kur 24
您可以执行以下操作
JFrame frame = new JFrame();
String[] options = new String[2];
options[0] = new String("Agree");
options[1] = new String("Disagree");
JOptionPane.showOptionDialog(frame.getContentPane(),"Message!","Title", 0,JOptionPane.INFORMATION_MESSAGE,null,options,null);
Run Code Online (Sandbox Code Playgroud)
输出如下

有关showOptionDialog()函数的更多详细信息,请参见此处.
您可以使用该options参数将自定义选项推送到showOptionDialog ;
Object[] options = { "Agree", "Disagree" };
JOptionPane.showOptionDialog(null, "These are my terms", "Terms",
JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE, null,
options, options[0]);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
20008 次 |
| 最近记录: |