List of usage examples for javafx.scene.control CheckMenuItem CheckMenuItem
public CheckMenuItem()
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);/*ww w .j ava 2 s. co 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(); }
From source file:org.drombler.fx.core.action.impl.FXToggleMenuItemFactory.java
@Override public MenuItem createToggleMenuItem(ToggleMenuEntryDescriptor toggleMenuEntryDescriptor, FXToggleAction action, int iconSize) { if (StringUtils.isNotEmpty(toggleMenuEntryDescriptor.getToggleGroupId())) { RadioMenuItem menuItem = new RadioMenuItem(); MenuItemUtils.configureRadioMenuItem(menuItem, action, iconSize); toggleGroupManager.configureToggle(menuItem, toggleMenuEntryDescriptor.getToggleGroupId()); return menuItem; } else {/* w w w . j a v a 2s. c om*/ CheckMenuItem menuItem = new CheckMenuItem(); MenuItemUtils.configureCheckMenuItem(menuItem, action, iconSize); return menuItem; } }