DEV Community

özkan pakdil
özkan pakdil

Posted on

How to assign shortcut to a button in fxml

I wanted to assign a button in fxml a keyboard shortcut. below is the example how to do that.

<Button mnemonicParsing="true" text="_Click Me">
Enter fullscreen mode Exit fullscreen mode

Now that button will have underscore on that "C" and user can call it automatically with key combination of ALT+C, The form that button should have the focus.
Example: https://github.com/ozkanpakdil/swaggerific/blob/main/src/main/resources/com/mascix/swaggerific/tab-request.fxml#L29

Top comments (0)