Example usage for javafx.fxml FXMLLoader setLocation

List of usage examples for javafx.fxml FXMLLoader setLocation

Introduction

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

Prototype

public void setLocation(URL location) 

Source Link

Document

Sets the location used to resolve relative path attribute values.

Usage

From source file:main.Content.java

public void showTableOverview() {
    try {//from w ww  .j a  v a 2s .  c  om
        FXMLLoader loader = new FXMLLoader();
        loader.setLocation(Main.class.getResource("view/TableLayout.fxml"));
        AnchorPane tableOverview = (AnchorPane) loader.load();

        rootLayout.setBottom(tableOverview);

        TableOverviewController controller = loader.getController();
        controller.setMainApp(this);
        controller.setTableData(data);
    } catch (IOException e) {
        e.printStackTrace();
    }
}

From source file:ua.com.ecotep.debtprevention.VnaklController.java

@FXML
private void handleDocSelectorAction(ActionEvent event) {
    if (selCl == null) {
        AlertDialog.showSimpleMessage("?    .",
                AlertDialog.ICON_INFO, parentInterface.getCurrentWindow());
        return;/*from w  ww.  j a va2  s  .  c  o m*/
    }
    Task<Object> task = DPSession.getInstance().getTask();
    if ((task != null) && (task.isRunning())) {
        AlertDialog.showSimpleMessage(
                "?    ?, -? .",
                AlertDialog.ICON_FORBIDDEN, parentInterface.getCurrentWindow());
        return;
    }
    Scene sceneParent = parentInterface.getCurrentWindow().getScene();
    final Point2D windowCoord = new Point2D(sceneParent.getWindow().getX(), sceneParent.getWindow().getY());
    final Point2D sceneCoord = new Point2D(sceneParent.getX(), sceneParent.getY());
    final Point2D nodeCoord = addDocButton.localToScene(0.0, 0.0);
    final double coordX = Math.round(windowCoord.getX() + sceneCoord.getX() + nodeCoord.getX());
    final double coordY = Math
            .round(windowCoord.getY() + sceneCoord.getY() + nodeCoord.getY() + addDocButton.getHeight() + 6);

    try {
        selectorPopup = new Popup();
        selectorPopup.setAutoHide(true);
        selectorPopup.setAutoFix(true);
        selectorPopup.setHideOnEscape(true);

        FXMLLoader loader = new FXMLLoader();
        loader.setLocation(getClass().getResource("/fxml/DocSelectScene.fxml"));

        AnchorPane root = (AnchorPane) loader.load();
        DocSelectController controller = loader.getController();
        controller.setParentInterface(this);
        Scene scene = new Scene(root);
        scene.setFill(null);
        selectorPopup.getContent().add(root);

        selectorPopup.setX(coordX);
        selectorPopup.setY(coordY);
        selectorPopup.show(parentInterface.getCurrentWindow());

    } catch (IOException ex) {
        Logger.getLogger(MainController.class.getName()).log(Level.SEVERE, null, ex);
        AlertDialog.showSimpleMessage(
                "? ?    !",
                AlertDialog.ICON_ERROR, parentInterface.getCurrentWindow());
    }
}

From source file:main.Content.java

public void initTabRootLayout(Activity totalSum) {
    try {/*from  w  ww  . j av a2 s. com*/
        FXMLLoader loader = new FXMLLoader();
        loader.setLocation(Main.class.getResource("view/TabRoot.fxml"));
        tabRootLayout = (TabPane) loader.load();

        tabRootLayout.setStyle(Main.class.getResource("view/DarkTheme.css").toString());

        chartTabController.setData(data);
        chartTabController.setTabPane(tabRootLayout);
        chartTabController.setMainApp(this);
        chartTabController.setActivitySum(totalSum);
        chartTabController.showChartOverview();
        tabRootLayout = chartTabController.getTabPane();

        rootLayout.setCenter(tabRootLayout);

    } catch (IOException e) {
        e.printStackTrace();
    }
}

From source file:main.Content.java

public boolean showInputDialog(Activity aktivitet) {
    try {/*from  w  w w .j a va2s.c o  m*/
        FXMLLoader loader = new FXMLLoader();
        loader.setLocation(Main.class.getResource("view/InputDialog.fxml"));
        AnchorPane page = (AnchorPane) loader.load();

        Stage dialogStage = new Stage();
        dialogStage.setTitle("Data Input");
        dialogStage.initModality(Modality.WINDOW_MODAL);
        dialogStage.initOwner(mainApp.getPrimaryStage());
        Scene scene = new Scene(page);
        dialogStage.setScene(scene);

        InputDialogController controller = loader.getController();
        controller.setListData(data);
        controller.setDialogStage(dialogStage);
        controller.setData(aktivitet);

        dialogStage.showAndWait();

        return controller.isSaveClicked();
    } catch (IOException ex) {
        Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
        return false;
    }
}

From source file:main.Content.java

public void showTreeView() {
    try {//from www  .j  av  a 2s .co m
        FXMLLoader loader = new FXMLLoader();
        loader.setLocation(Main.class.getResource("view/TreePane.fxml"));
        AnchorPane activityPaneOverview = (AnchorPane) loader.load();

        TreeViewController controller = loader.getController();
        ScrollPane scrollPane = new ScrollPane();

        controller.setMainApp(this);
        controller.setTableData(data);
        controller.startTreeView();

        TreeView<String> treeView = controller.getTree();

        scrollPane.setContent(treeView);
        treeView.autosize();

        activityPaneOverview.getStylesheets()
                .add(Main.class.getResource("view/DarkTheme.css").toExternalForm());

        activityPaneOverview.getChildren().add(scrollPane);
        activityPaneOverview.setTopAnchor(scrollPane, 10.0);
        activityPaneOverview.setLeftAnchor(scrollPane, 10.0);
        activityPaneOverview.setRightAnchor(scrollPane, 10.0);
        activityPaneOverview.setBottomAnchor(scrollPane, 10.0);

        scrollPane.setFitToHeight(true);
        scrollPane.setFitToWidth(true);

        rootLayout.setLeft(activityPaneOverview);

        System.out.println("showTreeOveerview u therrit" + index);

    } catch (IOException e) {
        e.printStackTrace();
    }
}

From source file:investiagenofx2.view.InvestiaGenOFXController.java

private void showInvestmentsSummary(String accountType, Double x, Double y) {
    try {//from   w  ww . ja  v a2s . com
        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:investiagenofx2.view.InvestiaGenOFXController.java

private void linkAccountTransac(String linkAccountTransac) {
    try {/*from w ww .j  ava2 s  .c o  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:mesclasses.view.JourneeController.java

@FXML
public void openPostIt() {
    try {/*  w ww.  ja  v a2 s.  co 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 {/*from   ww  w  . ja  v a  2  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.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:mesclasses.view.JourneeController.java

private Cours openCoursDialog(Cours cours) {

    try {//from www.j a va  2 s .  c  o 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;
}