I was wondering is it possible to change the OK Cancel Button to custom string in java? I have
JOptionPane.showConfirmDialog(message, title, JOptionPane.OK_CANCEL_OPTION);
Right now, the button will show "OK" and "Cancel". Is it possible to change the text for that? for example into "A" and "B" or maybe japanese text?
Thank you
Looks like instead of JOptionPane.showConfirmDialog
you are going to have to use JOptionPane.showOptionDialog
, which lets you supply your own texts as an array.
Try the following:
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");