Class FxmlUtil

java.lang.Object
cl.obcom.desktopfx.jfx.FxmlUtil

public final class FxmlUtil extends Object
Provides utility methods for working with FXML documents.
  • Method Details

    • load

      public static Parent load(Object controller) throws IOException
      Loads a FXML document using supplied controller. The resource name of the FXML document is assumed to be the simple name of the class of the controller plus the ".fxml" extension.
      Parameters:
      controller - the controller of the FXML document.
      Returns:
      a Parent containing the FXML document.
      Throws:
      NullPointerException - if controller is null.
      FileNotFoundException - if the FXML resource was not found.
      IOException - if I/O error occurs loading the FXML.
    • load

      public static Parent load(Object controller, String fxmlFile) throws IOException
      Loads an FXML document using specified controller and file.
      Parameters:
      controller - the controller of the FXML document.
      fxmlFile - the resource name of the FXML document.
      Returns:
      a Parent containing the FXML document.
      Throws:
      NullPointerException - if an argument is null.
      FileNotFoundException - if fxmlFile was not found.
      IOException - if I/O error occurs loading the FXML.
    • load

      public static Parent load(Object controller, URL fxmlURL) throws IOException
      Loads an FXML document using specified controller and URL.
      Parameters:
      controller - the controller of the FXML document.
      fxmlURL - the URL of the FXML document resource.
      Returns:
      a Parent containing the FXML document.
      Throws:
      NullPointerException - if an argument is null.
      IOException - if I/O error occurs loading the FXML.