List of usage examples for javafx.scene.control CustomMenuItem setHideOnClick
public final void setHideOnClick(boolean value)
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 menu = new Menu("File"); menu.getItems().add(new MenuItem("New")); menu.getItems().add(new MenuItem("Save")); menu.getItems().add(new SeparatorMenuItem()); menu.getItems().add(new MenuItem("Exit")); CustomMenuItem customMenuItem = new CustomMenuItem(new Slider()); customMenuItem.setHideOnClick(false); menu.getItems().add(customMenuItem); menuBar.getMenus().add(menu);//w ww . j a v a 2 s . co m menuBar.prefWidthProperty().bind(primaryStage.widthProperty()); root.getChildren().add(menuBar); primaryStage.setScene(scene); primaryStage.show(); }