Solved

JFileChooser and JOptionPane UI language problem

Posted on 2001-07-04
6
1,412 Views
Last Modified: 2012-05-04
When I set the locale (location) to "Chinese (Taiwan)" in window 200, the UI language in the JFileChooser of my java application will become chinese (e.g. the label "file name", "file type", "open" and "cancel", etc).  And when I change the locale to English, then the UI become english again.

How can I explicitly set the UI language for JFileChooser?

The same problem occurs when I call:
JOptionPane.showConfirmDialog(null, "xxx", "yyy", JOptionPane.YES_NO_OPTION)

The "yes" and "no" button will be affected by the OS locale.  How can I solve it?
0
Comment
Question by:cliffordhui
6 Comments
 
LVL 5

Expert Comment

by:Calron
ID: 6254354
The class Component (both JFileChooser and JOptionPane are derive from Component) have a method called setLocale( ... ). You will have to instantiate your JFileChooser or your JOptionPane and call that function with the specific Locale that you want.
0
 

Author Comment

by:cliffordhui
ID: 6254480
I have tried both setLocale(Locale.US) and setLocale(Locale.ENGLISH), it doesn't work.  The label and button fonts are still in chinese language when the locale of my computer is in Chinese(Taiwan).
0
 
LVL 5

Assisted Solution

by:Calron
Calron earned 25 total points
ID: 6254668
You are right, I hadn't tried it out. I have not been able to find a workaround to this problem (yet :) ). Sorry ...
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 3

Accepted Solution

by:
Dmitriy earned 25 total points
ID: 6255668
What if you try to set the parent frame's locale to be english specifically and then change File chooser's locale to chinese specifically.  Theoretically, only file chooser would then have the chinese locale
0
 
LVL 3

Expert Comment

by:Dmitriy
ID: 8567408
Anyone still monitors this question ;)?
0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 9017849
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:


[split points between Dmitriy and calron]


Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
sudhakar_koundinya
EE Cleanup Volunteer
---------------------
If you feel that your question was not properly addressed, or that none of the comments received were appropriate answers, please post your concern in THIS thread.
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
micro services vs rest web services 16 105
even odd program using while loop 3 40
java stored proc example 9 30
Unhandled exception type Exception 18 31
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will learn how to implement Singleton Design Pattern in Java.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question