Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
You want to create keyboard shortcuts for menu options.
Create an application that will use JavaFX's key combination APIs. The main classes you will be using are shown here:
javafx.scene.input.KeyCodejavafx.scene.input.KeyCodeCombinationjavafx.scene.input.KeyCombinationThe following source code listing is an application that displays the available keyboard shortcuts that are bound to menu items. When the user performs a keyboard shortcut the application will display the key combination on the screen:
        primaryStage.setTitle("Chapter 15-13 Associating Keyboard Sequences");
        Group root = new Group();
        Scene scene = new Scene(root, 530, 300, Color.WHITE);
        final StringProperty statusProperty = new SimpleStringProperty();
        InnerShadow iShadow = InnerShadowBuilder.create()
                .offsetX(3.5f)
                .offsetY(3.5f)
                .build();
        final Text status = TextBuilder.create()
            .effect(iShadow)
            .x(100)
            .y(50)
            .fill(Color.LIME)
            .font(Font.font(null, FontWeight.BOLD, 35))
            .translateY(50)
            .build();
        status.textProperty().bind(statusProperty);
        statusProperty.set("Keyboard Shortcuts \nCtrl-N, \nCtrl-S, \nCtrl-X");
        root.getChildren().add(status);
        MenuBar menuBar = new MenuBar();