Every tutorial about accelerators teaches how to use them FROM CODE, not from fxml files. There you'll learn how tu use the predefined KeyCombinations in order to achieve platform independence.
Now I wonder, if I write this in fxml:
<MenuItem mnemonicParsing="false" text="%menu.save" >
<accelerator>
<KeyCodeCombination alt="UP" code="Z" control="UP"meta="DOWN" shift="UP" shortcut="UP" />
</accelerator>
</MenuItem>
which should APPLE+S on mac, and should be CTRL+S on windows,
this should also work right? (PS: I don't own a windows OS/PC)
Now it's as simple as:
<MenuItem mnemonicParsing="false" text="%menu.save" accelerator="Shortcut+S"/>
where Shortcut
means Ctrl on Windows or Linux and Meta on Mac.
Here's some more information about KeyCombination
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With