Solved

JFileChooser and JOptionPane UI language problem

Posted on 2001-07-04
6
1,423 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
hibernate example for saving data 19 77
runtime exception 2 50
ejb example issues 3 54
JAVA API design with micro service cloud in mind 1 81
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

733 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