This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes JOptionPane - OK and Cancel buttons Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JOptionPane - OK and Cancel buttons" Watch "JOptionPane - OK and Cancel buttons" New topic

JOptionPane - OK and Cancel buttons

Alan Shiers
Ranch Hand

Joined: Sep 24, 2003
Posts: 237
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.

Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
Darryl Burke

Joined: May 03, 2008
Posts: 5115

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.

luck, db
There are no new questions, but there may be new answers.
Alan Shiers
Ranch Hand

Joined: Sep 24, 2003
Posts: 237
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.

I agree. Here's the link:
subject: JOptionPane - OK and Cancel buttons
It's not a secret anymore!