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

Semyon Sadetsky semyon.sadetsky at oracle.com
Tue Feb 7 15:13:16 UTC 2017


Hi Mikhail,

The fix itself is good.

Could you, please, remove the author tag from the test header? We have 
agreement to not use it anymore.

And the test frame need to be disposed after the test.

--Semyon


On 2/6/2017 4:32 PM, Mikhail Cherkasov wrote:
> 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