Here you can find the source of loadFxml(Node node)
Parameter | Description |
---|---|
node | the node |
Parameter | Description |
---|---|
IOException | Signals that an I/O exception has occurred. |
public static void loadFxml(Node node)
//package com.java2s; import java.io.IOException; import javafx.fxml.FXMLLoader; import javafx.scene.Node; public class Main { /**/*from w w w. ja va2 s . com*/ * Loads a fxml file and initializes a node as root and controller. * * @param node * the node * @throws IOException * Signals that an I/O exception has occurred. */ public static void loadFxml(Node node) { try { FXMLLoader fxmlLoader = new FXMLLoader(node.getClass() .getResource(node.getClass().getSimpleName() + ".fxml")); fxmlLoader.setRoot(node); fxmlLoader.setController(node); fxmlLoader.load(); } catch (IOException exception) { throw new RuntimeException(exception); } } }