Example usage for javafx.scene.control CheckMenuItem setText

List of usage examples for javafx.scene.control CheckMenuItem setText

Introduction

In this page you can find the example usage for javafx.scene.control CheckMenuItem setText.

Prototype

public final void setText(String value) 

Source Link

Usage

From source file:Main.java

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

    MenuBar menuBar = new MenuBar();

    Menu tools = new Menu("Your Menu");
    CheckMenuItem item = new CheckMenuItem();
    item.setText("Item 1");
    tools.getItems().add(item);//from   w  w  w  .j  a v  a 2s. c  o  m

    tools.getItems().add(CheckMenuItemBuilder.create().text("Item 2").selected(true).build());
    menuBar.getMenus().add(tools);

    menuBar.prefWidthProperty().bind(primaryStage.widthProperty());

    root.getChildren().add(menuBar);
    primaryStage.setScene(scene);
    primaryStage.show();
}