Example usage for javafx.scene.control Menu setMnemonicParsing

List of usage examples for javafx.scene.control Menu setMnemonicParsing

Introduction

In this page you can find the example usage for javafx.scene.control Menu setMnemonicParsing.

Prototype

public final void setMnemonicParsing(boolean value) 

Source Link

Usage

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    BorderPane root = new BorderPane();
    Scene scene = new Scene(root, 300, 250, Color.WHITE);

    MenuBar menuBar = new MenuBar();
    menuBar.prefWidthProperty().bind(primaryStage.widthProperty());
    root.setTop(menuBar);/*from  w  w w .  ja va2  s .com*/

    Menu fileMenu = new Menu("_File");
    fileMenu.setMnemonicParsing(true);
    MenuItem exitMenuItem = new MenuItem("Exit");
    fileMenu.getItems().add(exitMenuItem);
    exitMenuItem.setOnAction(actionEvent -> Platform.exit());

    menuBar.getMenus().addAll(fileMenu);

    primaryStage.setScene(scene);
    primaryStage.show();
}