Question : Locale problem in Java program that I implemented. How to fix?

I have a locale problem in my J2SE project having tabbed pane. When I run the program in US locale, there is no problem and the tabs are viewed just as I want whereas when I change the locale to TR, the program seems stuck while opening the tabs but it doesn't give any runtime error, just stuck. What should I do to fix it?

Is there way to supress Windows locale and set it as US locale whatever the target locale is? If not, do i have to have some if checks as if locale is US do this, else do that?

Best regards.

Answer : Locale problem in Java program that I implemented. How to fix?

You can use the UIManager to set the default locale for your Swing component. Just ensure to do this before you create any Swing components.

// Reapply LookAndFeel
UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
//  Directly change Swing's default Locale
UIManager.getDefaults().setDefaultLocale(Locale.US);


You can also use the below code to set the default locale for JVM.

Locale.setDefault(Locale.US);
Random Solutions  
 
programming4us programming4us