<Swing Dev> When running with the Nimbus look and feel, the JFileChooser does not display mnemonics for its controls.

Charles Lee littlee at linux.vnet.ibm.com
Wed Aug 3 04:44:52 UTC 2011


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.ogino at 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.ogino at 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

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch
URL: <http://mail.openjdk.java.net/pipermail/swing-dev/attachments/20110803/6b5dc687/patch.ksh>


More information about the swing-dev mailing list