<div dir="ltr">is it the only case  ?  <div>is there other keycode with the same issue? </div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le mar. 2 août 2022 à 12:47, Prasanta Sadhukhan <<a href="mailto:psadhukhan@openjdk.org">psadhukhan@openjdk.org</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">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.<br>
This is because [**VK_F4**](<a href="https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/classes/java/awt/event/KeyEvent.java#L506" rel="noreferrer" target="_blank">https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/classes/java/awt/event/KeyEvent.java#L506</a>) keycode is 0x73 (115 in decimal) which happens to be value of lowercase [**'s'** ](<a href="https://www.cs.cmu.edu/~pattis/15-1XX/common/handouts/ascii.html" rel="noreferrer" target="_blank">https://www.cs.cmu.edu/~pattis/15-1XX/common/handouts/ascii.html</a>) 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.<br>
<br>
Fix is made to ignore Action Keys from VK_F1->VK_F11 as displayed mnemonic which corresponds to lowercase p->z<br>
<br>
-------------<br>
<br>
Commit messages:<br>
 - Fix<br>
 - Fix<br>
 - 4850101: Setting mnemonic to VK_F4 underlines the letter S in a button.<br>
<br>
Changes: <a href="https://git.openjdk.org/jdk/pull/9712/files" rel="noreferrer" target="_blank">https://git.openjdk.org/jdk/pull/9712/files</a><br>
 Webrev: <a href="https://webrevs.openjdk.org/?repo=jdk&pr=9712&range=00" rel="noreferrer" target="_blank">https://webrevs.openjdk.org/?repo=jdk&pr=9712&range=00</a><br>
  Issue: <a href="https://bugs.openjdk.org/browse/JDK-4850101" rel="noreferrer" target="_blank">https://bugs.openjdk.org/browse/JDK-4850101</a><br>
  Stats: 139 lines in 2 files changed: 139 ins; 0 del; 0 mod<br>
  Patch: <a href="https://git.openjdk.org/jdk/pull/9712.diff" rel="noreferrer" target="_blank">https://git.openjdk.org/jdk/pull/9712.diff</a><br>
  Fetch: git fetch <a href="https://git.openjdk.org/jdk" rel="noreferrer" target="_blank">https://git.openjdk.org/jdk</a> pull/9712/head:pull/9712<br>
<br>
PR: <a href="https://git.openjdk.org/jdk/pull/9712" rel="noreferrer" target="_blank">https://git.openjdk.org/jdk/pull/9712</a><br>
</blockquote></div>