JDK-7024118 : possible hardcoded mnemonic for JFileChooser metal and motif l&f
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 7
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux_redhat_5.0
  • CPU: x86
  • Submitted: 2011-03-03
  • Updated: 2013-09-26
  • Resolved: 2011-09-20
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.
7u40Fixed 8 b06Fixed
As seen in following, 3 mnemonic keys seems to be hardcoded and making them unable to localize. Please consider externalizing them to src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal.properties for example.


            "FileChooser.lookInLabelMnemonic", new Integer(KeyEvent.VK_I),
            "FileChooser.fileNameLabelMnemonic", new Integer(KeyEvent.VK_N),
            "FileChooser.filesOfTypeLabelMnemonic", new Integer(KeyEvent.VK_T),
Similar hardcode also found in motif L&F.


            "FileChooser.pathLabelMnemonic", new Integer(KeyEvent.VK_P), // 'p'
            "FileChooser.filterLabelMnemonic", new Integer (KeyEvent.VK_R), // 'r'
            "FileChooser.foldersLabelMnemonic", new Integer (KeyEvent.VK_L), // 'l'
            "FileChooser.filesLabelMnemonic", new Integer (KeyEvent.VK_I), // 'i'
            "FileChooser.enterFileNameLabelMnemonic", new Integer (KeyEvent.VK_N), // 'n'

Since following keys in src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_xx.properties being translated, in some languages mnemonic character is not in label string and won't show up in gui.

FileChooser.pathLabelText=Enter path or folder name:
FileChooser.enterFileNameLabelText=Enter file name:
FileChooser.enterFolderNameLabelText=Enter folder name:

EVALUATION We should move hardcoded mnemonics from Metal, Motif and Windows LookAndFeels to properties files. We should also allow to use Integer and String values of "FileChooser.fileNameLabelMnemonic" and other mnemonics, because before the fix values are Integer, after the fix values are Strings (because of they are read from properties files)