List of usage examples for javafx.scene.control Menu getOnShown
public final EventHandler<Event> getOnShown()
From source file:Main.java
@Override public void start(final Stage primaryStage) { primaryStage.setTitle("title"); Group root = new Group(); Scene scene = new Scene(root, 400, 300, Color.WHITE); MenuBar menuBar = new MenuBar(); menuBar.prefWidthProperty().bind(primaryStage.widthProperty()); Menu menu = new Menu("File"); menu.setOnShown(new EventHandler<Event>() { @Override//from w w w .j a va 2 s . com public void handle(Event arg0) { } }); System.out.println(menu.getOnShown()); MenuItem newItem = new MenuItem("New", null); menu.getItems().add(newItem); menu.getItems().add(new SeparatorMenuItem()); menuBar.getMenus().add(menu); root.getChildren().add(menuBar); primaryStage.setScene(scene); primaryStage.show(); }