我想知道是否可以将 OK Cancel 按钮更改为 java 中的自定义字符串? 我有
JOptionPane.showConfirmDialog(message, title, JOptionPane.OK_CANCEL_OPTION);
此时,按钮将显示“确定”和“取消”。是否可以为此更改文本? 例如转换为“A”和“B”或者日语文本?
谢谢
最佳答案
看起来您将不得不使用 JOptionPane.showOptionDialog
而不是 JOptionPane.showConfirmDialog
,它允许您将自己的文本作为数组提供。
尝试以下操作:
JOptionPane.showOptionDialog(null,
"Do you like this answer?",
"Feedback",
JOptionPane.OK_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE,
null,
new String[]{"Yes I do", "No I don't"}, // this is the array
"default");
关于java - 更改 JOptionPane 中的 OK Cancel 字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8763075/