Example usage for javafx.fxml FXMLLoader setBuilderFactory

List of usage examples for javafx.fxml FXMLLoader setBuilderFactory

Introduction

In this page you can find the example usage for javafx.fxml FXMLLoader setBuilderFactory.

Prototype

public void setBuilderFactory(BuilderFactory builderFactory) 

Source Link

Document

Sets the builder factory used by this loader.

Usage

From source file:cz.lbenda.gui.controls.TextAreaFrmController.java

/** Create new instance return main node and controller of this node and sub-nodes */
public static Tuple2<Parent, TextAreaFrmController> createNewInstance() {
    URL resource = TextAreaFrmController.class.getResource(FXML_RESOURCE);
    try {/*from  ww  w  . j  a  va  2 s  .  c o  m*/
        FXMLLoader loader = new FXMLLoader();
        loader.setLocation(resource);
        loader.setBuilderFactory(new JavaFXBuilderFactory());
        Parent node = loader.load(resource.openStream());
        TextAreaFrmController controller = loader.getController();
        return new Tuple2<>(node, controller);
    } catch (IOException e) {
        LOG.error("Problem with reading FXML", e);
        throw new RuntimeException("Problem with reading FXML", e);
    }
}

From source file:cz.lbenda.dataman.db.frm.DbConfigFrmController.java

/** Create new instance return main node and controller of this node and sub-nodes */
public static Tuple2<Parent, DbConfigFrmController> createNewInstance() {
    URL resource = DbConfigFrmController.class.getResource(FXML_RESOURCE);
    try {/*from w w w.ja va 2  s . c  o m*/
        FXMLLoader loader = new FXMLLoader();
        loader.setLocation(resource);
        loader.setBuilderFactory(new JavaFXBuilderFactory());
        Parent node = loader.load(resource.openStream());
        DbConfigFrmController controller = loader.getController();
        return new Tuple2<>(node, controller);
    } catch (IOException e) {
        LOG.error("Problem with reading FXML", e);
        throw new RuntimeException("Problem with reading FXML", e);
    }
}

From source file:ninja.eivind.hotsreplayuploader.di.HotSReplayUploaderConfiguration.java

@Bean
public FXMLLoaderFactory fxmlLoader(ControllerFactory controllerFactory, BuilderFactory builderFactory) {
    return () -> {
        FXMLLoader loader = new FXMLLoader();
        loader.setControllerFactory(controllerFactory);
        loader.setBuilderFactory(builderFactory);
        return loader;
    };// w  w w  .  j a  va2 s .c  om
}

From source file:retsys.client.controller.LoginController.java

private Initializable replaceSceneContent(String fxml) throws Exception {

    URL location = getClass().getResource(fxml);
    FXMLLoader fxmlLoader = new FXMLLoader();

    fxmlLoader.setBuilderFactory(new JavaFXBuilderFactory());
    InputStream in = getClass().getResourceAsStream(fxml);
    Parent root;//from ww w  .j  av  a2  s. c  om

    fxmlLoader.setLocation(location);
    AnchorPane page;
    try {
        page = (AnchorPane) fxmlLoader.load(in);
    } finally {
        in.close();
    }

    Scene scene = new Scene(page);
    scene.getStylesheets().add(this.getClass().getResource("/retsys/client/css/styles.css").toExternalForm());
    stage.setScene(scene);
    stage.setFullScreen(true);
    //stage.sizeToScene();

    return (Initializable) fxmlLoader.getController();
}