Set JOptionPane button labels to French in Java
Description
The following code shows how to set JOptionPane button labels to French.
Example
// w ww. j ava 2 s . c o m
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.UIManager;
public class Main {
public static void main(final String[] args) {
UIManager.put("OptionPane.cancelButtonText", "Annuler");
UIManager.put("OptionPane.noButtonText", "Non");
UIManager.put("OptionPane.okButtonText", "D'accord");
UIManager.put("OptionPane.yesButtonText", "Oui");
JFrame parent = new JFrame();
String multiLineMsg[] = { "Hello,", "World"} ;
JOptionPane.showMessageDialog(parent, multiLineMsg);
}
}
The code above generates the following result.
Home »
Java Tutorial »
Swing »
Java Tutorial »
Swing »