LoginSignup
11
9

More than 5 years have passed since last update.

JavaFXでショートカットキーを設定する

Last updated at Posted at 2014-07-02

JavaFXでショートカットキーを設定する場合は、Accelerratorに「Shortcut+C」などと設定するとよい。
Windowsでは「Ctrl+C」、OS Xでは「Command+C」として表示されるのでOS毎の違いを気にしなくてよくなる。

SnapCrab_JavaFX Scene Builder - Releasefxml_2014-7-2_17-32-41_No-00.png

コードで書く場合は以下のようにする。

keyCombination.java
KeyCombination copyKey = KeyCombination.valueOf("Shortcut+c");
copyMenu.setAccelerator(copyKey);
11
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
9