My menu-button
is a bit wider:
.menu-button {
-fx-pref-width: 250px;
-fx-background-color: #72b3c9;
-fx-padding: 5 16 5 16;
}
and the menu with its items (and their accelerators) is displayed as expected, like this:
But when I want to align the width of menu-item
to the width of menu-button
, like this:
.menu-item {
-fx-pref-width: 250px;
-fx-pref-height: 40px;
-fx-padding: 5px 16px 5px 16px;
}
then I don't get the accelerators aligned to the right of the menu items:
What I would want (and expect) is that the accelerators are following the width of the menu item and that are aligned to the right edges of their respective menu items, like this:
How can I achieve that?
Edit:
A hack to increase the left-label padding could be used, thus forcing the accelerators more to the right:
.menu-item .label {
-fx-padding: 0 120px 0 0;
}
But, that is a hard-coded platform-dependent approach that needs to be adjusted each time a menu item label text or an accelerator is changed.
menu-item
? – Bo HalimmenuItem.setAccelerator(KeyCombination.keyCombination(keyCombination));
. – Saran