Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6967461

Nimbus L&F: JFileChooser popup menu entries are not localized

XMLWordPrintable

      FULL PRODUCT VERSION :
      java version "1.6.0_20"
      Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
      Java HotSpot(TM) Client VM (build 16.3-b01, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows 2000 [Version 5.00.2195]

      A DESCRIPTION OF THE PROBLEM :
      If the Nimbus L&F is used, the JFileChooser dialog has a context menu that can be accessed by right clicking on the file list component. This popup menu is in English no matter what locale has been set, unlike the rest of the dialog.

      See the attached code snippet for an example. The file chooser dialog is in French, but the mentioned popup menu is in English.

      An issue that may be directly related is the following: If the default locale is changed *after* Nimbus is chosen as the L&F, but before the JFileChooser is created and shown, then the "All files" file filter's description is localized using the locale that was in effect when Nimbus was initialized. Uncomment lines 19 and 20 in the attached code example to reproduce this bug. The dialog will be in German, but the file filter will be in French.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Run the attached test case.
      2. A file chooser dialog is shown.
      3. Right click on the file list component to reveal a popup menu.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      File chooser dialog should be in French, and so should the popup menu.
      ACTUAL -
      File chooser dialog is in French, but the popup menu is in English.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.util.Locale;
      import javax.swing.*;
      import javax.swing.UIManager.LookAndFeelInfo;

      public class Main {
      public static void main(String[] args) {
      Locale.setDefault(Locale.FRENCH);
      JComponent.setDefaultLocale(Locale.FRENCH);

      try {
      for (LookAndFeelInfo info: UIManager.getInstalledLookAndFeels()) {
      if ("Nimbus".equals(info.getName())) {
      UIManager.setLookAndFeel(info.getClassName());
      break;
      }
      }
      } catch (Exception wtf) {}

      //Locale.setDefault(Locale.GERMAN);
      //JComponent.setDefaultLocale(Locale.GERMAN);

      JFileChooser fileChooser = new JFileChooser();
      fileChooser.showOpenDialog(null);
      }
      }
      ---------- END SOURCE ----------

            Unassigned Unassigned
            igor Igor Nekrestyanov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: