RFR: 4850101: Setting mnemonic to VK_F4 underlines the letter S in a button. [v2]
Prasanta Sadhukhan
psadhukhan at openjdk.org
Wed Aug 17 03:25:33 UTC 2022
> It is seen that using VK_F4 in JButton's setMnemonic(int i), causes the letter 'S' in the JButton to be underlined if JButton's text has 'S' in its string.
> This is because [**VK_F4**](https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/classes/java/awt/event/KeyEvent.java#L506) keycode is 0x73 (115 in decimal) which happens to be value of lowercase [**'s'** ](https://www.cs.cmu.edu/~pattis/15-1XX/common/handouts/ascii.html) so as per the logic implemented in SwingUtilities.findDisplayedMnemonicIndex(), the first index of the character (either lowecasr or uppercase) is returned as a mnemonic, which gets underlined.
>
> Fix is made to ignore Action Keys from VK_F1->VK_F11 as displayed mnemonic which corresponds to lowercase p->z
Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:
Modify check for lowercase character
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/9712/files
- new: https://git.openjdk.org/jdk/pull/9712/files/9942d8bb..3f4ae080
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=9712&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=9712&range=00-01
Stats: 12 lines in 1 file changed: 0 ins; 10 del; 2 mod
Patch: https://git.openjdk.org/jdk/pull/9712.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/9712/head:pull/9712
PR: https://git.openjdk.org/jdk/pull/9712
More information about the client-libs-dev
mailing list