JDK-8233045 : JFileChooser does not consider locales other than English
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 11,13,14
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_10
  • CPU: x86_64
  • Submitted: 2019-10-20
  • Updated: 2019-10-29
  • Resolved: 2019-10-29
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 14
14Resolved
Related Reports
Duplicate :  
Description
ADDITIONAL SYSTEM INFORMATION :
Windows 10 vs 1903
java version "13.0.1" 2019-10-15
Java(TM) SE Runtime Environment (build 13.0.1+9)
Java HotSpot(TM) 64-Bit Server VM (build 13.0.1+9, mixed mode, sharing)



A DESCRIPTION OF THE PROBLEM :
Whatever the operating system's language or an explicitly set default locale, JFileChooser is always displayed in English.
Was working correctly under jdk 10.0.2.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
(Uncomment line 8,) compile and run the code below.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Labels and buttons according to current default locale.
ACTUAL -
English

---------- BEGIN SOURCE ----------
import java.util.*;
import javax.swing.*;

public class FileChooserTest {

  public FileChooserTest() {
//  If your operating system is English, set to any non-English locale.
//    Locale.setDefault(Locale.FRENCH);  // line 8
    System.out.println(Locale.getDefault());
    JFileChooser fileChooser= new JFileChooser();
    fileChooser.showDialog(null, null);
//    fileChooser.showOpenDialog(null);
//    fileChooser.showSaveDialog(null);
  }

  static public void main(String args[]) {
    SwingUtilities.invokeLater(FileChooserTest::new);
  }
}
---------- END SOURCE ----------

FREQUENCY : always



Comments
JFileChooser fails to consider locales other then English. Checked this with reported version and could confirm the issue. Results: ======== 8u231: OK 10.0.2: OK 11: Fail 13: Fail 14: Fail This is a regression introduced in JDK 11. To verify run the attached test case with respected JDK versions. Make sure that the system locale/language is switched to other then default (French in test case)
28-10-2019