2

I have a question regarding the JOptionPane.showInputDialog. The buttons I have are OK and Cancel, but I was wondering if it was possible to localize these to a particular Locale i will provide?

Thank you.

Pseudonymous
  • 625
  • 1
  • 5
  • 13
  • 1
    http://stackoverflow.com/questions/8763075/change-the-ok-cancel-string-in-joptionpane – Areca Dec 27 '16 at 08:51
  • Yeah, @Areca, that could definitely be a way out of it. I’d still wish for a cleaner solution to localization exactly. – Ole V.V. Dec 27 '16 at 09:15

1 Answers1

0

Did you check the documentation? Or try your favourite search engine? This is quite easy when you know how:

    JComponent.setDefaultLocale(Locale.GERMAN);
    JOptionPane.showInputDialog("Guten Tag");

The above shows an input dialog with buttons labeled “OK” and “Abbrechen” (which I believe to be German usage, I am not an expert there, and in any case it is different from the “Cancel” label I get otherwise).

Ole V.V.
  • 81,772
  • 15
  • 137
  • 161