Java examples for JavaFX:Node
get JavaFX Node by ID
import java.io.File; import java.util.Optional; import javafx.scene.Node; import javafx.scene.control.TextInputDialog; import javafx.stage.DirectoryChooser; import javafx.stage.Stage; public class Main{ @SuppressWarnings("unchecked") public static <T extends Node> T getNode(Node root, String id) { final Node node = root.lookup(id); if (node == null) { throw new NullPointerException( "cannot find child node fx:id for argument: " + id); }/* www . j av a2 s . c o m*/ return (T) node; } }