JFileChooser and JOptionPane UI language problem

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?
cliffordhuiAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
DmitriyConnect With a Mentor Commented:
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
 
CalronCommented:
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
 
cliffordhuiAuthor Commented:
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
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
CalronConnect With a Mentor Commented:
You are right, I hadn't tried it out. I have not been able to find a workaround to this problem (yet :) ). Sorry ...
0
 
DmitriyCommented:
Anyone still monitors this question ;)?
0
 
sudhakar_koundinyaCommented:
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
All Courses

From novice to tech pro — start learning today.