<Swing Dev> [9] RFR JDK-8173145: Menu is activated after using mnemonic Alt/Key combination

Sergey Bylokhov sergey.bylokhov at oracle.com
Tue Feb 7 14:19:46 UTC 2017


Looks fine to me then. But I am not an expert in this area.

> 
> Hi Sergey,
> 
> I've just finished with tests, no new failures, everything works as before the fix.
> 
> Thanks,
> Mikhail.
> 
> On 06.02.2017 17:03, Sergey Bylokhov wrote:
>> Hi, Mikhail.
>> Can you please confirm that you run a regression/jck tests. What about other L&F, why they are skipped in the test?
>> 
>>> Hi all,
>>> 
>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8173145
>>> Webrev: http://cr.openjdk.java.net/~mcherkas/8173145/webrev.00/
>>> 
>>> The problem appears because AltProcessor  doesn't reset altKeyPressed flag when
>>> not-alt key pressed, but event is consumed.
>>> This situation is possible when all events consumed by key bindings. A menubar is activated while
>>> user expects only key binding actions.
>>> In my test a button should be activated by alt+m mnemonic, but a menu is activate, because
>>> key pressed/released consumed by mnemonic combination and key typed event is
>>> consumed by DefaultEditorKit$DefaultDeyTypedAction that is installed for JTextField,
>>> as result instead of button, menu is activated.
>>> 
>>> To fix the issue I added resetting altKeyPressed flag if any non-alt key pressed despite consuming state,
>>> because obviously user what make some alt+[KEY] action instead of menu activation.
>>> 
>>> Thanks,
>>> Mikhail.
> 




More information about the swing-dev mailing list