On 08/02/2011 03:53 PM, Pavel Porvatov wrote:
Hi Charles,
On 08/02/2011 05:04 AM, Pavel Porvatov wrote:
Hi Charles,
On 07/29/2011 05:44 PM, Pavel Porvatov wrote:
Hi Charles,
On 07/29/2011 04:34 PM, Pavel Porvatov wrote:
Hi Charles,
On 07/27/2011 06:44 PM, Pavel Porvatov wrote:
Hi Charles,

I attached your patch to the CR. Not sure I'll have time to test and commit the fix.

Regards, Pavel

On 03/30/2011 07:43 PM, Pavel Porvatov wrote:
Hi Charles,
Hi guys,

When running with Nimbus LaF, JFileChooser does not display mnemonics for its controls, see FileNameAndTypeNomnemonics.png (attached)
After patch (attached)
You will find FileNameAndTypeWithMnemonics.png (attached)

I filed CR 7032436 (When running with the Nimbus look and feel, the JFileChooser does not display mnemonics) for the described problem

Thanks, Pavel
Hi guys,

I have tested this issue on the openjdk 8 and it still there. Attached is a patch which rebased on the openjdk8.

Would anyone like to put this patch into the openjdk8 and fix this issue?


Thanks Pavel.

Does anyone else have time to take a look at this issue? I will treat him one beer :-)

Oops, then I'll take participation in this =)

Seriously, there are several comments to your fix:

1. You changed windows.properties and metal.properties, but you shouldn't do this (e.g. because of CR description "When running with the Nimbus look and feel, the JFileChooser does not display mnemonics"). If you take a look at current JFileChooser you will see that mnemonics are exist... That's because of CR 7024118 (possible hardcoded mnemonic for JFileChooser metal and motif l&f) and it will be great if you fix this also after CR 7032436. Your current implementation for Win/Metal LAFs is uncompleted actually...

2. You should COPY new mnemonics into all synth properties like synth_de.properties etc... Our i18n team will update them later.

3. To be consistent with other LAFs could you use something like "lookInLabelMnemonic = UIManager.getInt("FileChooser.lookInLabelMnemonic");" (like in Metal/Windows)? That means also that you should use VK_XXX codes instead of chars in properties files

4. Could you please use something like "hg diff -g" for patch creating (see http://openjdk.org/contribute/ for details). I have some problems with your patch format.

Thanks, Pavel
Hi Pavel,

Would you please tell me which repository you see the mnemonics are exist? openjdk7, openjdk8? openjdk8_tl? openjdk8_2d? openjdk8_*?
All described above. Mnemonics are hardcoded, see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7024118 for details. Just run JFileChooserDemo or SwingSet2 demo and you will see that mnemonics are exist.
The patch issue maybe related to the different repo you and me are using. I am using git to clone the openjdk8 repo and patch apply well with patch command.
Ok, I found the command that works with your patch format...

I will try to refine the patch according to your comments.

Thanks for quick response :-)

You are welcome

Regards, Pavel
Hi Pavel,

Has sunbug 7024118 already been committed in the repository? I can not find "7024118" related commit log and the latest build from the repo forest http://hg.openjdk.java.net/jdk8/jdk8 still shows the problem. I will try to refine the patch if I can access sunbug 7024118 and 7032436 to check whether the patch is necessary.

Oops, when I sent the bug URL it was available.... Anyway below are details about 7024118:

Synopsis: possible hardcoded mnemonic for JFileChooser metal and motif l&f
Description:
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.

src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java

"FileChooser.lookInLabelMnemonic", new Integer(KeyEvent.VK_I), "FileChooser.fileNameLabelMnemonic", new Integer(KeyEvent.VK_N), "FileChooser.filesOfTypeLabelMnemonic", new Integer(KeyEvent.VK_T),
*** (#1 of 2): 2011-03-03 13:22:48 MSK shinya.og...@oracle.com

Similar hardcode also found in motif L&F.

src/share/classes/com/sun/java/swing/plaf/motif/MotifLookAndFeel.java

"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.filterLabelText=Filter
FileChooser.foldersLabelText=Folders
FileChooser.filesLabelText=Files
FileChooser.enterFileNameLabelText=Enter file name:
FileChooser.enterFolderNameLabelText=Enter folder name:
*** (#2 of 2): 2011-03-04 09:24:58 MSK shinya.og...@oracle.com


CR 7024118 is not fixed and therefore you cannot find fix in openjdk8. I don't see now any reasons to fix CR 7024118 and CR 7032436 in one patch.

Regards, Pavel
I see. Thanks Pavel. I have to wait for 7024118 and 7032436 (maybe). :-)

I didn't catch, what do you mean in "I have to wait for 7024118". Actually I'm waiting new patch version of CR 7032436 from you :)

Regards, Pavel
Ooops, Here it is (attached).
1. I am not sure whether I understand "Our i18n team will update them later" correctly. I just put the same things in different properties. 2. I do not think we should use VK_XXXX code. CR7024118 recommends to remove the VK_XXX code right?
3. If the patch is ok, I would like to fix CR7024118 also.

--
Yours Charles

diff --git 
src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth.properties 
src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth.properties
index d222689..c06d43f 100644
--- 
src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth.properties
+++ 
src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth.properties
@@ -43,3 +43,8 @@ FileChooser.fileSizeHeaderText=Size
 FileChooser.fileTypeHeaderText=Type
 FileChooser.fileDateHeaderText=Modified
 FileChooser.fileAttrHeaderText=Attributes
+FileChooser.lookInLabelMnemonic=I
+FileChooser.fileNameLabelMnemonic=N
+FileChooser.folderNameLabelMnemonic=F
+FileChooser.filesOfTypeLabelMnemonic=T
+FileChooser.filesOfTypeMnemonic=T
diff --git 
src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_de.properties
 
src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_de.properties
index 990f344..953ceea 100644
--- 
src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_de.properties
+++ 
src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_de.properties
@@ -43,3 +43,8 @@ FileChooser.fileSizeHeaderText=Gr\u00F6\u00DFe
 FileChooser.fileTypeHeaderText=Typ
 FileChooser.fileDateHeaderText=Ge\u00E4ndert
 FileChooser.fileAttrHeaderText=Attribute
+FileChooser.lookInLabelMnemonic=I
+FileChooser.fileNameLabelMnemonic=N
+FileChooser.folderNameLabelMnemonic=F
+FileChooser.filesOfTypeLabelMnemonic=T
+FileChooser.filesOfTypeMnemonic=T
diff --git 
src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_es.properties
 
src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_es.properties
index 03d2166..5d828ed 100644
--- 
src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_es.properties
+++ 
src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_es.properties
@@ -43,3 +43,8 @@ FileChooser.fileSizeHeaderText=Tama\u00F1o
 FileChooser.fileTypeHeaderText=Tipo
 FileChooser.fileDateHeaderText=Modificado
 FileChooser.fileAttrHeaderText=Atributos
+FileChooser.lookInLabelMnemonic=I
+FileChooser.fileNameLabelMnemonic=N
+FileChooser.folderNameLabelMnemonic=F
+FileChooser.filesOfTypeLabelMnemonic=T
+FileChooser.filesOfTypeMnemonic=T
diff --git 
src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_fr.properties
 
src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_fr.properties
index 273351d..0f7ebe0 100644
--- 
src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_fr.properties
+++ 
src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_fr.properties
@@ -43,3 +43,8 @@ FileChooser.fileSizeHeaderText=Taille
 FileChooser.fileTypeHeaderText=Type
 FileChooser.fileDateHeaderText=Modifi\u00E9
 FileChooser.fileAttrHeaderText=Attributs
+FileChooser.lookInLabelMnemonic=I
+FileChooser.fileNameLabelMnemonic=N
+FileChooser.folderNameLabelMnemonic=F
+FileChooser.filesOfTypeLabelMnemonic=T
+FileChooser.filesOfTypeMnemonic=T
diff --git 
src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_it.properties
 
src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_it.properties
index da2e2c7..23c5522 100644
--- 
src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_it.properties
+++ 
src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_it.properties
@@ -43,3 +43,8 @@ FileChooser.fileSizeHeaderText=Dimensioni
 FileChooser.fileTypeHeaderText=Tipo
 FileChooser.fileDateHeaderText=Modificato
 FileChooser.fileAttrHeaderText=Attributi
+FileChooser.lookInLabelMnemonic=I
+FileChooser.fileNameLabelMnemonic=N
+FileChooser.folderNameLabelMnemonic=F
+FileChooser.filesOfTypeLabelMnemonic=T
+FileChooser.filesOfTypeMnemonic=T
diff --git 
src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_ja.properties
 
src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_ja.properties
index 382fcf8..6fa00ba 100644
--- 
src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_ja.properties
+++ 
src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_ja.properties
@@ -43,3 +43,8 @@ FileChooser.fileSizeHeaderText=\u30B5\u30A4\u30BA
 FileChooser.fileTypeHeaderText=\u30BF\u30A4\u30D7
 FileChooser.fileDateHeaderText=\u4FEE\u6B63\u65E5
 FileChooser.fileAttrHeaderText=\u5C5E\u6027
+FileChooser.lookInLabelMnemonic=I
+FileChooser.fileNameLabelMnemonic=N
+FileChooser.folderNameLabelMnemonic=F
+FileChooser.filesOfTypeLabelMnemonic=T
+FileChooser.filesOfTypeMnemonic=T
diff --git 
src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_ko.properties
 
src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_ko.properties
index adc9b1d..783ec58 100644
--- 
src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_ko.properties
+++ 
src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_ko.properties
@@ -43,3 +43,8 @@ FileChooser.fileSizeHeaderText=\uD06C\uAE30
 FileChooser.fileTypeHeaderText=\uC720\uD615
 FileChooser.fileDateHeaderText=\uC218\uC815 \uB0A0\uC9DC
 FileChooser.fileAttrHeaderText=\uC18D\uC131
+FileChooser.lookInLabelMnemonic=I
+FileChooser.fileNameLabelMnemonic=N
+FileChooser.folderNameLabelMnemonic=F
+FileChooser.filesOfTypeLabelMnemonic=T
+FileChooser.filesOfTypeMnemonic=T
diff --git 
src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_pt_BR.properties
 
src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_pt_BR.properties
index b14a61f..e42e5e4 100644
--- 
src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_pt_BR.properties
+++ 
src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_pt_BR.properties
@@ -43,3 +43,8 @@ FileChooser.fileSizeHeaderText=Tamanho
 FileChooser.fileTypeHeaderText=Tipo
 FileChooser.fileDateHeaderText=Modificado
 FileChooser.fileAttrHeaderText=Atributos
+FileChooser.lookInLabelMnemonic=I
+FileChooser.fileNameLabelMnemonic=N
+FileChooser.folderNameLabelMnemonic=F
+FileChooser.filesOfTypeLabelMnemonic=T
+FileChooser.filesOfTypeMnemonic=T
diff --git 
src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_sv.properties
 
src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_sv.properties
index 9167b72..51c5b94 100644
--- 
src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_sv.properties
+++ 
src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_sv.properties
@@ -43,3 +43,8 @@ FileChooser.fileSizeHeaderText=Storlek
 FileChooser.fileTypeHeaderText=Typ
 FileChooser.fileDateHeaderText=\u00C4ndrad
 FileChooser.fileAttrHeaderText=Attribut
+FileChooser.lookInLabelMnemonic=I
+FileChooser.fileNameLabelMnemonic=N
+FileChooser.folderNameLabelMnemonic=F
+FileChooser.filesOfTypeLabelMnemonic=T
+FileChooser.filesOfTypeMnemonic=T
diff --git 
src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_zh_CN.properties
 
src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_zh_CN.properties
index 547fd15..bb305ae 100644
--- 
src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_zh_CN.properties
+++ 
src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_zh_CN.properties
@@ -43,3 +43,8 @@ FileChooser.fileSizeHeaderText=\u5927\u5C0F
 FileChooser.fileTypeHeaderText=\u7C7B\u578B
 FileChooser.fileDateHeaderText=\u4FEE\u6539\u65E5\u671F
 FileChooser.fileAttrHeaderText=\u5C5E\u6027
+FileChooser.lookInLabelMnemonic=I
+FileChooser.fileNameLabelMnemonic=N
+FileChooser.folderNameLabelMnemonic=F
+FileChooser.filesOfTypeLabelMnemonic=T
+FileChooser.filesOfTypeMnemonic=T
diff --git 
src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_zh_TW.properties
 
src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_zh_TW.properties
index 1144f61..2103373 100644
--- 
src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_zh_TW.properties
+++ 
src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_zh_TW.properties
@@ -43,3 +43,8 @@ FileChooser.fileSizeHeaderText=\u5927\u5C0F
 FileChooser.fileTypeHeaderText=\u985E\u578B
 FileChooser.fileDateHeaderText=\u4FEE\u6539\u65E5\u671F
 FileChooser.fileAttrHeaderText=\u5C6C\u6027
+FileChooser.lookInLabelMnemonic=I
+FileChooser.fileNameLabelMnemonic=N
+FileChooser.folderNameLabelMnemonic=F
+FileChooser.filesOfTypeLabelMnemonic=T
+FileChooser.filesOfTypeMnemonic=T
diff --git src/share/classes/sun/swing/plaf/synth/SynthFileChooserUIImpl.java 
src/share/classes/sun/swing/plaf/synth/SynthFileChooserUIImpl.java
index e971d9d..9362175 100644
--- src/share/classes/sun/swing/plaf/synth/SynthFileChooserUIImpl.java
+++ src/share/classes/sun/swing/plaf/synth/SynthFileChooserUIImpl.java
@@ -473,16 +473,16 @@ public class SynthFileChooserUIImpl extends 
SynthFileChooserUI {
 
         Locale l = fc.getLocale();
 
-        lookInLabelMnemonic = getMnemonic("FileChooser.lookInLabelMnemonic", 
l);
+        lookInLabelMnemonic = 
(int)(UIManager.getString("FileChooser.lookInLabelMnemonic", l).charAt(0));
         lookInLabelText = UIManager.getString("FileChooser.lookInLabelText", 
l);
         saveInLabelText = UIManager.getString("FileChooser.saveInLabelText", 
l);
 
-        fileNameLabelMnemonic = 
getMnemonic("FileChooser.fileNameLabelMnemonic", l);
+        fileNameLabelMnemonic = 
(int)(UIManager.getString("FileChooser.fileNameLabelMnemonic", l).charAt(0));
         fileNameLabelText = 
UIManager.getString("FileChooser.fileNameLabelText", l);
-        folderNameLabelMnemonic = 
getMnemonic("FileChooser.folderNameLabelMnemonic", l);
+        folderNameLabelMnemonic = 
(int)(UIManager.getString("FileChooser.folderNameLabelMnemonic", l).charAt(0));
         folderNameLabelText = 
UIManager.getString("FileChooser.folderNameLabelText", l);
 
-        filesOfTypeLabelMnemonic = 
getMnemonic("FileChooser.filesOfTypeLabelMnemonic", l);
+        filesOfTypeLabelMnemonic = 
(int)(UIManager.getString("FileChooser.filesOfTypeLabelMnemonic", l).charAt(0));
         filesOfTypeLabelText = 
UIManager.getString("FileChooser.filesOfTypeLabelText", l);
 
     upFolderToolTipText =  
UIManager.getString("FileChooser.upFolderToolTipText",l);
@@ -501,11 +501,6 @@ public class SynthFileChooserUIImpl extends 
SynthFileChooserUI {
     detailsViewButtonAccessibleName = 
UIManager.getString("FileChooser.detailsViewButtonAccessibleName",l);
     }
 
-    private int getMnemonic(String key, Locale l) {
-        return SwingUtilities2.getUIDefaultsInt(key, l);
-    }
-
-
     public String getFileName() {
         if (fileNameTextField != null) {
             return fileNameTextField.getText();

Reply via email to