<Swing Dev> [9] Review Request for 7172652: With JDK 1.7 text field does not obtain focus when using mnemonic Alt/Key combin

Semyon Sadetsky semyon.sadetsky at oracle.com
Mon Apr 20 14:53:59 UTC 2015


Hello,

please review a fix for JDK9:

webrev: http://cr.openjdk.java.net/~ssadetsky/7172652/webrev.00/
bug: https://bugs.openjdk.java.net/browse/JDK-7172652

***ROOT CAUSE
This is a bug in Label UI's key release event processing routine for key 
mnemonics: only one release event is captured instead of two (Alt 
release and the mnemonic key release). The Alt release event goes up on 
hierarchy and is captured by the parent internal frame's menu bar for 
which Alt key release means selection change event under the Windows 
system LnF.

***SOLUTION
Change key release event handling logic to capture events from both Alt 
modifier and the key. The logic takes into account that when the first 
release key event come it transfers focus back to the field so the 
second key release event should be captured from any window component.

***TESTING
A simple scenario is written to exclusively cover the situation.

--Semyon




More information about the swing-dev mailing list