• Post Reply Bookmark Topic Watch Topic
  • New Topic

Standard Localised Strings for "Ok" "Cancel"  RSS feed

 
Fabricio Sanchez
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

I want to create localised standard buttons that say "Yes", "No", "Ok" and "Cancel". Is there a way to get to these Strings?

I've tried looking at the source code for JOptionPane but couldn't find what I'm looking for.

Thank you,

Fabricio
 
Brian Cole
Author
Ranch Hand
Posts: 937
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Fabricio Sanchez:
I want to create localised standard buttons that say "Yes", "No", "Ok" and "Cancel". Is there a way to get to these Strings?

I've tried looking at the source code for JOptionPane but couldn't find what I'm looking for.


I'm not sure what you are asking. Two possible responses:

1) The JOptionPane buttons will automatically be localized. If you run

java.util.Locale.setDefault(java.util.Locale.GERMANY);
JOptionPane.showConfirmDialog(null, "demo");


the buttons will read 'Ja', 'Nein', and 'Abbrechen'.

2) If you know what text you would like to see on JOptionPane buttons, then just go ahead and specify the text:

Object[] texts = { "Esnay", "Onay", "Ancelcay" }; // pig latin
JOptionPane.showOptionDialog(null, "demo", "Select an Option", JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, texts, texts[0]);
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!