Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JOptionPane - OK and Cancel buttons

 
Alan Shiers
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

I'm trying to make my application bilingual: English and French. When I prompt the user for input using JOptionPane.showInputDialog it appears with OK and Cancel buttons. That's fine for the English speaking folks, but how do I change the text on the Cancel button to the French equivelant: Annuler. The OK button is the same in French, so I don't need to change it. If I later expand to include Spanish, the OK and Cancel buttons should really read: Aceptar and Cancelar respectively.

Please advise.

Alan
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Darryl Burke
Bartender
Posts: 5132
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All Components have a setLocale(....) method and JComponents have setDefaultLocale(...). Don't reinvent the wheel.Read the API for Locale for more information and links to valid language and country codes.
 
Alan Shiers
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the guidance guys. Really appreciate it. The support you all provide here is awesome. On this particular topic you provided exactly what I needed.

Alan
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic