Example usage for javafx.fxml FXMLLoader load

List of usage examples for javafx.fxml FXMLLoader load

Introduction

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

Prototype

public <T> T load() throws IOException 

Source Link

Document

Loads an object hierarchy from a FXML document.

Usage

From source file:gov.va.isaac.gui.preferences.plugins.ViewCoordinatePreferencesPluginViewController.java

protected static ViewCoordinatePreferencesPluginViewController construct() throws IOException {
    // Load from FXML.
    URL resource = ViewCoordinatePreferencesPluginViewController.class
            .getResource("ViewCoordinatePreferencesPluginView.fxml");
    log.debug("Loaded URL {}", resource);
    FXMLLoader loader = new FXMLLoader(resource);
    loader.load();
    return loader.getController();
}

From source file:dev.archiecortez.jfacelog.dialogs.NewPassDialog.java

public NewPassDialog() throws IOException {
    super();//from   www.j av a2s  .c  o m
    FXMLLoader loader = new FXMLLoader(getClass().getResource("newpassdialog.fxml"));
    loader.setController(this);

    Parent root = loader.load();
    this.getDialogPane().setContent(root);
    getDialogPane().getButtonTypes().add(ButtonType.APPLY);
    getDialogPane().getButtonTypes().add(ButtonType.CANCEL);
    getDialogPane().lookupButton(ButtonType.APPLY).disableProperty()
            .bind(newPassword.textProperty().isNotEqualTo(newPasswordCopy.textProperty())
                    .or(newPassword.textProperty().isEmpty()).or(oldPassword.textProperty().isEmpty()));

    setResultConverter(value -> {
        if (value == ButtonType.APPLY) {
            return new Pair<>(oldPassword.getText(), newPassword.getText());
        } else {
            return null;
        }
    });
}

From source file:tworpus.client.mainwindow.MainWindowController.java

@FXML
public void showOpenSession() {
    try {/*  www .  ja  va2 s. c  o m*/
        FXMLLoader loader = new FXMLLoader(openSessionFXML);
        Pane pane = (Pane) loader.load();
        maincontent = pane;
        borderPane.centerProperty().set(maincontent);

    } catch (IOException ex) {
        Logger.getLogger(MainWindowController.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:tworpus.client.mainwindow.MainWindowController.java

@FXML
public void showCorpusForm() {
    try {/*from  w  w  w  .j a  va  2  s.c  o m*/
        FXMLLoader loader = new FXMLLoader(createCorpusFXML);
        Pane pane = (Pane) loader.load();

        // @TODO: may be deleted. Just for demonstation how to get controller
        CreateCorpusController controller = loader.getController();

        maincontent = pane;
        borderPane.centerProperty().set(maincontent);
    } catch (IOException ex) {
        Logger.getLogger(MainWindowController.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:org.craftercms.social.migration.MigrationTool.java

@Override
public void start(final Stage primaryStage) throws Exception {
    loadProperties();// ww  w  . j  a v  a2s.co m
    log.debug("Loading Fxml file");
    FXMLLoader loader = new FXMLLoader(getClass().getResource("/scenes/Main.fxml"));
    log.debug("Fxml file Loaded, Starting scene");
    Scene scene = new Scene((VBox) loader.load());
    final MainController controller = loader.getController();
    controller.setScene(scene);
    primaryStage.setScene(scene);
    primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>() {
        @Override
        public void handle(final WindowEvent windowEvent) {
            controller.stopTasks();
        }
    });
    primaryStage.setTitle("Crafter Social/Profile Migration Tool (2.3->2.5)");
    log.debug("Showing UI. {}", new Date());
    primaryStage.show();

}

From source file:com.toyota.carservice.config.config2.java

public Object newStage3(Stage stage, Label lb, String load, String judul, boolean resize, StageStyle style,
        boolean maximized) {
    try {//from w  ww .j av  a2 s.c  o m
        Stage st = new Stage();
        stage = (Stage) lb.getScene().getWindow();
        FXMLLoader root = new FXMLLoader(getClass().getResource(load));

        Scene scene = new Scene(root.load());
        st.initStyle(style);
        st.setResizable(resize);
        st.setMaximized(maximized);
        st.setTitle(judul);
        st.setScene(scene);
        ApplicationContext appContex = config.getInstance().getApplicationContext();
        Resource resource = appContex.getResource("classpath:com/toyota/carservice/img/kallatoyota.png");
        st.getIcons().add(new Image(resource.getURI().toString()));
        st.show();
        return root.getController();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}

From source file:com.toyota.carservice.config.config2.java

public Object newStage(Stage stage, Label lb, String load, String judul, boolean resize, StageStyle style,
        boolean maximized) {
    try {//w  w w. j  a  va 2s .  c o m
        Stage st = new Stage();
        stage = (Stage) lb.getScene().getWindow();
        FXMLLoader root = new FXMLLoader(getClass().getResource(load));

        Scene scene = new Scene(root.load());
        st.initStyle(style);
        st.setResizable(resize);
        st.setMaximized(maximized);
        st.setTitle(judul);
        st.setScene(scene);
        ApplicationContext appContex = config.getInstance().getApplicationContext();
        Resource resource = appContex.getResource("classpath:com/toyota/carservice/img/kallatoyota.png");
        st.getIcons().add(new Image(resource.getURI().toString()));
        st.show();
        stage.close();
        return root.getController();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}

From source file:com.toyota.carservice.config.config2.java

public Object newStage2(Stage stage, Button lb, String load, String judul, boolean resize, StageStyle style,
        boolean maximized) {
    try {/* w  w w . ja  v a 2 s .  co m*/
        Stage st = new Stage();
        stage = (Stage) lb.getScene().getWindow();
        FXMLLoader root = new FXMLLoader(getClass().getResource(load));

        Scene scene = new Scene(root.load());
        st.initStyle(style);
        st.setResizable(resize);
        st.setMaximized(maximized);
        st.setTitle(judul);
        st.setScene(scene);
        ApplicationContext appContex = config.getInstance().getApplicationContext();
        Resource resource = appContex.getResource("classpath:com/toyota/carservice/img/kallatoyota.png");
        st.getIcons().add(new Image(resource.getURI().toString()));
        st.show();
        stage.close();
        return root.getController();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}

From source file:com.fishbeans.app.FXMLComponentBase.java

private FXMLLoader doLoad(URL fxml) throws IllegalStateException {

    FXMLLoader loader = new FXMLLoader(fxml);
    loader.setControllerFactory(this::createControllerAsBean);

    try {//  w w w  .  j  a va2  s  . c  o m
        loader.load();
    } catch (IOException ex) {
        throw new IllegalStateException(ex);
    }

    return loader;
}

From source file:br.com.ajaio.midas.desktop.MainApp.java

public void initRootLayout() {
    try {//from   w  ww. jav  a 2  s.c o m
        FXMLLoader loader = new FXMLLoader();
        loader.setLocation(MainApp.class.getResource("view/rootLayoutFXML.fxml"));
        rootLayout = (BorderPane) loader.load();

        RootLayoutController rootLayoutController = loader.getController();
        rootLayoutController.setMainApp(this);

        Scene scene = new Scene(rootLayout);
        primaryStage.setScene(scene);
        primaryStage.show();
    } catch (IOException ex) {
        ex.printStackTrace();
    }
}