If mnemonicParsing is enabled through FXML, and the Menu label is set, for example, as "_File", an extra space is appended to the end of the Menu's label. This is easy to visualize by stripping all padding from the MenuBar, Menu, and Menu label. Compare to other Menu items with mnemonicParsing disabled, and they don't have the extra space. Removing the mnemonicParsing from the "_File" Menu label will rectify the issue.
I would conjecture that the width of the Menu label is possibly being calculated based on the value of the label prior to mnemonicParsing being evaluated. Once mnemonicParsing is evaluated, the "_" character is removed from the label. Since the width has already been calculated, it appears as though there is extra space on the label.
Furthermore, it appears that the mnemonicParsing attribute is ignored if the underscore is present. As long as the underscore is present in the Menu's text attribute, it will enable mnemonicParsing regardless.
I would conjecture that the width of the Menu label is possibly being calculated based on the value of the label prior to mnemonicParsing being evaluated. Once mnemonicParsing is evaluated, the "_" character is removed from the label. Since the width has already been calculated, it appears as though there is extra space on the label.
Furthermore, it appears that the mnemonicParsing attribute is ignored if the underscore is present. As long as the underscore is present in the Menu's text attribute, it will enable mnemonicParsing regardless.
- duplicates
-
JDK-8089193 Width of menu is affected by mnemonic-identifier
-
- Resolved
-