Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8087364

mnemonicParsing in FXML appends extra space to rendered Menu labels

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • tbd
    • 7u40, 8
    • javafx
    • Windows 7 64-bit, JDK 7u51

      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.

            aghaisas Ajit Ghaisas
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: