Javafx + FXML + Accelerators --- Platform Independence?

Each accelerator tutorial teaches how to use their FROM CODE, not fxml files. There you will learn how to use the predefined KeyCombinations 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 be APPLE + Son mac, and should be CTRL+ Son windows,

should this work correctly too? (PS: I do not have Windows / PC)

+4
source share
1 answer

Now it is as simple as:

<MenuItem mnemonicParsing="false" text="%menu.save" accelerator="Shortcut+S"/>

where Shortcutmeans Ctrlon Windows or Linux and Metaon Mac.
Here is more information aboutKeyCombination .

+9

All Articles