Example usage for javafx.fxml FXMLLoader FXMLLoader

List of usage examples for javafx.fxml FXMLLoader FXMLLoader

Introduction

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

Prototype

public FXMLLoader() 

Source Link

Document

Creates a new FXMLLoader instance.

Usage

From source file:calendarioSeries.vistas.MainViewController.java

@FXML
private void addNewSerie() {
    Parent root;/*from   w w  w .j  a  v a 2s .  c  o m*/
    try {
        FXMLLoader loader = new FXMLLoader();
        loader.setLocation(MainViewController.class.getResource("NewSerieView.fxml"));
        root = loader.load();

        NewSerieController controller = loader.getController();
        controller.setMainController(this);

        Stage stage = new Stage();
        stage.setTitle("Aade una nueva serie");
        stage.setScene(new Scene(root));
        stage.setMinHeight(650);
        stage.setMinWidth(600);
        stage.setResizable(false);
        stage.show();
    } catch (IOException e) {
        e.printStackTrace();
    }
}

From source file:mesclasses.view.JourneeController.java

private Cours openCoursDialog(Cours cours) {

    try {/*w  ww . j a v a 2s.  co m*/
        FXMLLoader loader = new FXMLLoader();
        loader.setLocation(MainApp.class.getResource(Constants.COURS_EDIT_DIALOG));
        AnchorPane page = (AnchorPane) loader.load();

        // Create the dialog Stage.
        Stage dialogStage = new Stage();
        dialogStage.setTitle("Cration d'un cours ponctuel");
        dialogStage.initModality(Modality.WINDOW_MODAL);
        dialogStage.initOwner(primaryStage);
        Scene scene = new Scene(page);
        dialogStage.setScene(scene);
        // Set the person into the controller.
        CoursEditDialogController controller = loader.getController();
        controller.setDialogStage(dialogStage);
        controller.setCours(cours, true);

        dialogStage.showAndWait();
        int status = controller.getStatus();
        if (status >= 0) {
            //update/cancel
            return controller.getCours();
        }
    } catch (IOException e) {
        ModalUtil.alert("Erreur I/O", e.getMessage());
    }
    return null;
}

From source file:com.joliciel.talismane.terminology.viewer.TerminologyViewerController.java

@FXML
protected void handleMenuSettingsPreferences(ActionEvent event) throws Exception {
    Stage preferencesStage = new Stage();
    preferencesStage.initModality(Modality.WINDOW_MODAL);
    FXMLLoader fxmlLoader = new FXMLLoader();
    Parent root = (Parent) fxmlLoader.load(getClass().getResource("preferences.fxml").openStream());

    PreferencesController controller = fxmlLoader.getController();
    controller.setPrimaryStage(preferencesStage);
    controller.setPrimaryController(this);

    preferencesStage.setTitle("Talismane Terminology Viewer Preferences");
    preferencesStage.setScene(new Scene(root, 400, 300));
    preferencesStage.show();//from   w  w w  .j  a v  a 2  s  .  com
}

From source file:mesclasses.view.JourneeController.java

@FXML
public void openPostIt() {
    try {/*from  w ww.  ja v  a2 s.  c o  m*/
        // Load the fxml file and create a new stage for the popup dialog.
        FXMLLoader loader = new FXMLLoader();
        loader.setLocation(MainApp.class.getResource(Constants.POSTIT_DIALOG));
        AnchorPane page = (AnchorPane) loader.load();

        // Create the dialog Stage.
        Stage dialogStage = new Stage();
        dialogStage.setTitle("Post-It");
        dialogStage.initModality(Modality.WINDOW_MODAL);
        dialogStage.initOwner(primaryStage);
        Scene scene = new Scene(page);
        dialogStage.setScene(scene);

        // Set the person into the controller.
        PostItDialogController controller = loader.getController();
        controller.setDialogStage(dialogStage);
        controller.setClasse(seanceSelect.getValue().getClasse());

        // Show the dialog and wait until the user closes it
        dialogStage.showAndWait();

    } catch (IOException e) {
        LOG.error(e);
    }
}

From source file:mesclasses.view.JourneeController.java

@FXML
public void openActions() {
    try {//  w  w w. ja va  2 s.  c  om
        // Load the fxml file and create a new stage for the popup dialog.
        FXMLLoader loader = new FXMLLoader();
        loader.setLocation(MainApp.class.getResource(Constants.ACTIONS_DIALOG));
        AnchorPane page = (AnchorPane) loader.load();

        // Create the dialog Stage.
        Stage dialogStage = new Stage();
        dialogStage.setTitle("Actions  faire");
        dialogStage.initModality(Modality.NONE);
        dialogStage.initOwner(primaryStage);
        Scene scene = new Scene(page);
        dialogStage.setScene(scene);

        // Set the person into the controller.
        ActionsEnCoursController controller = loader.getController();
        controller.setDialogStage(dialogStage);
        controller.setClasse(seanceSelect.getValue().getClasse());

        // Show the dialog and wait until the user closes it
        dialogStage.showAndWait();

    } catch (IOException e) {
        LOG.error(e);
    }
}

From source file:investiagenofx2.view.InvestiaGenOFXController.java

private void linkAccountTransac(String linkAccountTransac) {
    try {//from  w  ww.  j  a va2s  .co  m
        FXMLLoader loader = new FXMLLoader();
        loader.setLocation(InvestiaGenOFX.class.getResource("view/linkaccountTransac.fxml"));
        AnchorPane page = (AnchorPane) loader.load();

        Stage dialogStage = new Stage();
        dialogStage.setTitle("Associer les comptes");
        dialogStage.getIcons().add(new Image("/myIcons/Teddy-Bear-Sick-icon.png"));
        dialogStage.initModality(Modality.WINDOW_MODAL);
        Scene scene = new Scene(page);
        dialogStage.initOwner(InvestiaGenOFX.getPrimaryStage());
        dialogStage.setScene(scene);
        InvestiaGenOFX.setOnCloseRequest(dialogStage);

        LinkaccountTransacController controller = loader.getController();
        controller.setlinkAccountTransac(linkAccountTransac);
        dialogStage.showAndWait();
    } catch (Exception ex) {
        Logger.getLogger(InvestiaGenOFXController.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:investiagenofx2.view.InvestiaGenOFXController.java

private void showInvestmentsSummary(String accountType, Double x, Double y) {
    try {//from  www.  j  a  v a  2s  . co m
        FXMLLoader loader = new FXMLLoader();
        loader.setLocation(InvestiaGenOFX.class.getResource("view/investmentsSummary.fxml"));
        AnchorPane page = (AnchorPane) loader.load();

        Stage dialogStage = new Stage();
        dialogStage.setTitle("Sommaire des Investissements " + accountType);
        dialogStage.getIcons().add(new Image("/myIcons/Teddy-Bear-Sick-icon.png"));
        dialogStage.initModality(Modality.NONE);
        Scene scene = new Scene(page);
        dialogStage.initOwner(InvestiaGenOFX.getPrimaryStage());
        dialogStage.setX(x);
        dialogStage.setY(y);
        dialogStage.setScene(scene);
        dialogStage.show();
    } catch (Exception ex) {
        Logger.getLogger(InvestiaGenOFXController.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:UI.MainStageController.java

@FXML
/**/*  ww w. j av  a 2s.  c o m*/
 * runs when the optionsButton is clicked
 * opens the Options stage
 *
 */
private void optionsButtonClicked() {
    FXMLLoader fxmlLoader = new FXMLLoader();
    Parent root = null;
    try {
        fxmlLoader.setLocation(Main.class.getClassLoader().getResource("UI/optionsGui.fxml"));
        root = fxmlLoader.load();

    } catch (Exception e) {
        try {
            fxmlLoader.setLocation(
                    new URL("file:" + new File("").getCanonicalPath().concat("src/UI/optionsGui.fxml")));
            root = fxmlLoader.load();
        } catch (Exception e2) {
            System.err.println("ERROR: Couldn't find optionsGui.fxml!");
        }
    }

    this.optionsStage = new Stage();
    optionsStage.setTitle("Options");
    Scene optionsScene = new Scene(root, 1000, 700);
    optionsStage.setScene(optionsScene);
    optionsScene.getStylesheets().add(GlobalConstants.LIGHTTHEME);
    optionsStage.show();
}