Java examples for JavaFX:Menu
Adds a event handler to the given JavaFX menu.
//package com.java2s; import javafx.scene.control.MenuItem; public class Main { /**/*from ww w. ja va2 s . c om*/ * Adds a event handler to the given menu. * @param menuItem The menu item that should trigger the action * @param action the action */ public static void defineItemAction(MenuItem menuItem, Runnable action) { menuItem.setOnAction((e) -> action.run()); } }