I've added Mnemonics to a menu bar using JavaFX 2.2 and Scene Builder, but it doesn't work 100% well.
This is my menu:
When I press Alt, it looks like this, which is correct:
Then I press "D", and the menu opens, but the Mnemonics inside the menu are not underlined:
The lines do appear when I press Alt again; however, then the line under the "D" of "Datei" disappears:
So it seems to be some kind of buggy toggling function in JavaFX.
Anyway, I want the Mnemonics to be underlined all at once, just like when I click the menu:
When you click the menus with the mouse and then press Alt all Mnemonics are correctly underlined at once. Pressing Alt again will toggle between underlined and not underlined. This is the normal, expected behavior.
So I think when opening a menu via Mnemonics, the Oracle guys just forgot to call some kind of "underlineMnemonics()" method for the submenu. Does anybody know what method that is, so I can call it myself when opening a menu? Or does anyone have another workaround?
For example, I know that you can make the underlines of the main menu bar visible via CSS:
.mnemonic-underline {
-fx-stroke: -fx-text-base-color;
}
But I failed to make this work on the submenus. (Also, this would not be an ideal solution, because this way the underlines couldn't be toggled off again.)