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(Charset charset) 

Source Link

Document

Creates a new FXMLLoader instance.

Usage

From source file:genrsa.GenRSAController.java

/**
 * Mtodo usado para cargar la ventana de ataque ciclico
 * @param event /*w w w  .j  a v a 2s. c o m*/
 */
public void Cyclic(ActionEvent event) {
    FXMLLoader fxmlLoader;
    Parent root;

    try {
        secondStage = new Stage();
        fxmlLoader = new FXMLLoader(getClass().getResource("/Cyclic/Cyclic.fxml"));
        root = fxmlLoader.load();

        CyclicController cyclicController = fxmlLoader.<CyclicController>getController();
        cyclicController.setRadix(this.radix);

        if (this.RSA != null) {

            cyclicController.getModulus().setText(this.RSA.getN().toString(this.radix).toUpperCase());
            cyclicController.getExponent().setText(this.RSA.getE().toString(this.radix).toUpperCase());
        } else {
            cyclicController.setFirstTime(false);
        }

        disableOnProgress(true);

        Scene scene = new Scene(root);
        secondStage.initModality(Modality.NONE);
        secondStage.getIcons()
                .add(new Image(GenRSAController.class.getResourceAsStream("/allImages/genRSA.png")));
        secondStage.setTitle("genRSA - Ataque Cclico");
        secondStage.setScene(scene);
        secondStage.show();

        secondStage.setOnCloseRequest(closeEvent -> {
            cyclicController.getCyclicAtack().setIsCancelled(true);
            this.disableOnProgress(false);
            this.disableButtons();
        });

    } catch (IOException ex) {
        //no pongo mensaje de error, porque no se puede dar el caso
    }

}

From source file:genrsa.GenRSAController.java

/**
 * Mtodo usado para cargar la ventana de ataque por la paradoja del cumpleaos
 * @param event //w w w .  j  av a2s  .  com
 */
public void Paradox(ActionEvent event) {
    FXMLLoader fxmlLoader;
    Parent root;

    try {
        secondStage = new Stage();
        fxmlLoader = new FXMLLoader(getClass().getResource("/Paradox/Paradox.fxml"));
        root = fxmlLoader.load();

        ParadoxController paradoxController = fxmlLoader.<ParadoxController>getController();
        paradoxController.setRadix(this.radix);

        if (this.RSA != null) {
            paradoxController.getModulus().setText(this.RSA.getN().toString(this.radix).toUpperCase());
            paradoxController.getExponent().setText(this.RSA.getE().toString(this.radix).toUpperCase());
        } else {
            paradoxController.setFirstTime(false);
        }

        disableOnProgress(true);

        Scene scene = new Scene(root);
        secondStage.initModality(Modality.NONE);
        secondStage.getIcons()
                .add(new Image(GenRSAController.class.getResourceAsStream("/allImages/genRSA.png")));
        secondStage.setTitle("genRSA - Ataque por la Paradoja del Cumpleaos");
        secondStage.setScene(scene);
        secondStage.show();

        secondStage.setOnCloseRequest(closeEvent -> {
            paradoxController.getParadoxAttack().setIsCancelled(true);

            this.disableOnProgress(false);
            this.disableButtons();
        });

    } catch (IOException ex) {
        //no pongo mensaje de error, porque no se puede dar el caso
    }

}

From source file:acmi.l2.clientmod.l2smr.Controller.java

private void showUmodel(final String obj, final String file) {
    Platform.runLater(() -> {//from  www.j ava  2 s.c om
        try {
            FXMLLoader loader = new FXMLLoader(getClass().getResource("smview/smview.fxml"));
            loader.load();
            SMView controller = loader.getController();
            controller.setStaticmesh(getStaticMeshDir(), file, obj);
            Scene scene = new Scene(loader.getRoot());
            scene.setOnKeyReleased(controller::onKeyReleased);

            Stage smStage = new Stage();
            smStage.setScene(scene);
            smStage.setTitle(obj);
            smStage.show();

            smStage.setX(Double.parseDouble(L2smr.getPrefs().get("smview.x", String.valueOf(smStage.getX()))));
            smStage.setY(Double.parseDouble(L2smr.getPrefs().get("smview.y", String.valueOf(smStage.getY()))));
            smStage.setWidth(Double
                    .parseDouble(L2smr.getPrefs().get("smview.width", String.valueOf(smStage.getWidth()))));
            smStage.setHeight(Double
                    .parseDouble(L2smr.getPrefs().get("smview.height", String.valueOf(smStage.getHeight()))));

            InvalidationListener listener = observable -> {
                L2smr.getPrefs().put("smview.x", String.valueOf(Math.round(smStage.getX())));
                L2smr.getPrefs().put("smview.y", String.valueOf(Math.round(smStage.getY())));
                L2smr.getPrefs().put("smview.width", String.valueOf(Math.round(smStage.getWidth())));
                L2smr.getPrefs().put("smview.height", String.valueOf(Math.round(smStage.getHeight())));
            };
            smStage.xProperty().addListener(listener);
            smStage.yProperty().addListener(listener);
            smStage.widthProperty().addListener(listener);
            smStage.heightProperty().addListener(listener);
        } catch (IOException e) {
            onException("Couldn't show staticmesh", e);
        }
    });
}

From source file:genrsa.GenRSAController.java

/**
 * Mtodo usado para cargar la ventana de Cifra
 * @param event // ww w .  j av  a 2s . c om
 */
public void DeCipher(ActionEvent event) {
    FXMLLoader fxmlLoader;
    Parent root;
    int iterator;

    try {
        secondStage = new Stage();
        fxmlLoader = new FXMLLoader(getClass().getResource("/DeCipher/DeCipher.fxml"));
        root = fxmlLoader.load();

        DeCipherController DeCipherCtr = fxmlLoader.<DeCipherController>getController();

        DeCipherCtr.setPubKeyBI(this.RSA.getE());
        DeCipherCtr.setModulusBI(this.RSA.getN());
        DeCipherCtr.setRadix(this.radix);

        //parte grfica
        DeCipherCtr.getModulus().setText(
                this.utilidades.putPoints(this.RSA.getN().toString(this.radix).toUpperCase(), this.radix));
        DeCipherCtr.getPubKey().setText(
                this.utilidades.putPoints(this.RSA.getE().toString(this.radix).toUpperCase(), this.radix));

        DeCipherCtr.getModulus1().setText(
                this.utilidades.putPoints(this.RSA.getN().toString(this.radix).toUpperCase(), this.radix));
        //obtengo todas las claves privadas parejas
        String[] PPK = this.claves_parejas.getText().split("\n");

        //las meto en el comboBox
        ComboBox comboBox = DeCipherCtr.getPrivKeys();
        comboBox.getItems().add("Clave Privada");
        comboBox.getItems()
                .add(this.utilidades.putPoints(this.RSA.getD().toString(this.radix).toUpperCase(), this.radix));
        comboBox.getItems().add("Claves Privadas Parejas");
        for (iterator = 0; iterator < PPK.length; iterator++) {
            comboBox.getItems().add(PPK[iterator]);
        }
        comboBox.setValue(
                this.utilidades.putPoints(this.RSA.getD().toString(this.radix).toUpperCase(), this.radix));
        comboBox.setVisibleRowCount(7);

        disableOnProgress(true);

        Scene scene = new Scene(root);
        secondStage.initModality(Modality.NONE);
        secondStage.getIcons()
                .add(new Image(GenRSAController.class.getResourceAsStream("/allImages/genRSA.png")));
        secondStage.setTitle("genRSA - Cifrado y Descifrado");
        secondStage.setScene(scene);
        secondStage.show();

        secondStage.setOnCloseRequest(closeEvent -> {
            this.disableOnProgress(false);
            this.disableButtons();
        });

    } catch (IOException ex) {
        //no pongo mensaje de error, porque no se puede dar el caso
    }

}

From source file:com.github.drbookings.ui.controller.MainController.java

private void showAddBookingDialog(final LocalDate date, final String roomName) {
    try {// ww  w  .  j a v  a 2 s  . c  o  m
        final FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/AddBookingView.fxml"));
        final Parent root = loader.load();
        final Stage stage = new Stage();
        stage.setWidth(300);
        stage.setHeight(600);
        final Scene scene = new Scene(root);
        stage.setTitle("Add BookingBean");
        stage.setScene(scene);
        final AddBookingController c = loader.getController();
        c.setManager(manager);
        c.datePickerCheckIn.setValue(date);
        c.comboBoxRoom.getSelectionModel().select(roomName);
        final Stage windowStage = (Stage) node.getScene().getWindow();
        stage.initOwner(windowStage);
        stage.initModality(Modality.WINDOW_MODAL);
        stage.setX(windowStage.getX() + windowStage.getWidth() / 2 - stage.getWidth() / 2);
        stage.setY((windowStage.getY() + windowStage.getHeight()) / 2 - stage.getHeight() / 2);
        stage.show();
    } catch (final IOException e) {
        logger.error(e.getLocalizedMessage(), e);
    }
}

From source file:genrsa.GenRSAController.java

/**
 * Mtodo usado para cargar la ventana de Firma
 * @param event /*  w ww  .j a  va 2 s  . com*/
 */
public void Sign(ActionEvent event) {
    FXMLLoader fxmlLoader;
    Parent root;
    int iterator;

    try {
        secondStage = new Stage();
        fxmlLoader = new FXMLLoader(getClass().getResource("/Sign/Sign.fxml"));
        root = fxmlLoader.load();

        SignController SignCtr = fxmlLoader.<SignController>getController();

        SignCtr.setPubKeyBI(this.RSA.getE());
        SignCtr.setModulusBI(this.RSA.getN());
        SignCtr.setRadix(this.radix);

        //parte grfica
        SignCtr.getModulus().setText(
                this.utilidades.putPoints(this.RSA.getN().toString(this.radix).toUpperCase(), this.radix));
        SignCtr.getPubKey().setText(
                this.utilidades.putPoints(this.RSA.getE().toString(this.radix).toUpperCase(), this.radix));

        SignCtr.getModulus1().setText(
                this.utilidades.putPoints(this.RSA.getN().toString(this.radix).toUpperCase(), this.radix));
        //obtengo todas las claves privadas parejas
        String[] PPK = this.claves_parejas.getText().split("\n");
        //quito la informacion acerca de los bits "--> XXbits"

        //las meto en el comboBox
        ComboBox comboBox = SignCtr.getPrivKeys();
        comboBox.getItems().add("Clave Privada");
        comboBox.getItems()
                .add(this.utilidades.putPoints(this.RSA.getD().toString(this.radix).toUpperCase(), this.radix));
        comboBox.getItems().add("Claves Privadas Parejas");
        for (iterator = 0; iterator < PPK.length; iterator++) {
            comboBox.getItems().add(PPK[iterator]);
        }
        comboBox.setValue(
                this.utilidades.putPoints(this.RSA.getD().toString(this.radix).toUpperCase(), this.radix));
        comboBox.setVisibleRowCount(7);

        disableOnProgress(true);

        Scene scene = new Scene(root);
        secondStage.initModality(Modality.NONE);
        secondStage.getIcons()
                .add(new Image(GenRSAController.class.getResourceAsStream("/allImages/genRSA.png")));
        secondStage.setTitle("genRSA - Firma y Validacin");
        secondStage.setScene(scene);
        secondStage.show();

        secondStage.setOnCloseRequest(closeEvent -> {
            this.disableOnProgress(false);
            this.disableButtons();
        });

    } catch (IOException ex) {
        //no pongo mensaje de error, porque no se puede dar el caso
    }

}

From source file:com.github.drbookings.ui.controller.MainController.java

private void showSettingsICal() {
    try {//from  ww w.java 2s. co m
        final FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/ICalSettingsView.fxml"));
        final Parent root = loader.load();
        final Stage stage = new Stage();
        final Scene scene = new Scene(root);
        stage.setTitle("iCal Settings");
        stage.setScene(scene);
        stage.setWidth(600);
        stage.setHeight(400);
        stage.show();
    } catch (final IOException e) {
        logger.error(e.getLocalizedMessage(), e);
    }
}

From source file:com.github.drbookings.ui.controller.MainController.java

private void showUpcomingEvents() {
    try {//from www .  java 2 s.c om
        final FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/UpcomingView.fxml"));
        final Parent root = loader.load();
        final Stage stage = new Stage();
        final Scene scene = new Scene(root);
        stage.setTitle("What's next");
        stage.setScene(scene);
        stage.setWidth(600);
        stage.setHeight(400);
        final Stage windowStage = (Stage) node.getScene().getWindow();
        stage.setX(windowStage.getX() + windowStage.getWidth() / 2 - stage.getWidth() / 2);
        stage.setY((windowStage.getY() + windowStage.getHeight()) / 2 - stage.getHeight() / 2);
        final UpcomingController c = loader.getController();
        c.setManager(getManager());
        stage.show();
    } catch (final IOException e) {
        logger.error(e.getLocalizedMessage(), e);
    }
}

From source file:genrsa.GenRSAController.java

/**
 * Muestra por pantalla la informacin relativa a genRSA 
 * @param event /* w ww.j  a  v a  2s.  com*/
 */
public void aboutGenRSA(ActionEvent event) {
    Stage stage;
    FXMLLoader fxmlLoader;
    Parent root;

    try {
        stage = new Stage();
        fxmlLoader = new FXMLLoader(getClass().getResource("/About/About.fxml"));
        root = fxmlLoader.load();

        Scene scene = new Scene(root);
        stage.initModality(Modality.APPLICATION_MODAL);
        stage.initOwner(this.unitsD.getScene().getWindow());
        stage.setResizable(false);
        stage.getIcons().add(new Image(GenRSAController.class.getResourceAsStream("/allImages/genRSA.png")));
        stage.setTitle("Acerca de genRSA v2.1");
        stage.setScene(scene);
        stage.show();

    } catch (IOException ex) {
        //no pongo mensaje de error, porque no se puede dar el caso
    }

}

From source file:snpviewer.SnpViewer.java

private void zoomRegion(Rectangle rectangle) {
    try {/*from   ww  w. j a  v a2  s .  c o m*/
        FXMLLoader loader = new FXMLLoader(getClass().getResource("ZoomRegionView.fxml"));
        ChromosomeLength chromLength = new ChromosomeLength(genomeVersion);
        String currentChrom = (String) chromosomeBoxList[chromosomeSelector.getSelectionModel()
                .getSelectedIndex()];
        double startCoordinate = chromLength.getLength(currentChrom) / selectionOverlayPane.getWidth()
                * rectangle.getX();
        double selectionWidth = chromLength.getLength(currentChrom) / selectionOverlayPane.getWidth()
                * rectangle.getWidth();
        if (rectangle.getX() == 0) {
            startCoordinate = 1;
        }

        Pane page = (Pane) loader.load();
        Scene scene = new Scene(page);
        Stage stage = new Stage();
        stage.setScene(scene);
        stage.setTitle("chr" + currentChrom + ":" + nf.format(startCoordinate) + "-"
                + nf.format(startCoordinate + selectionWidth));
        scene.getStylesheets().add(SnpViewer.class.getResource("SnpViewerStyleSheet.css").toExternalForm());
        String subPath = "zoom";
        stage.initModality(Modality.NONE);
        stage.getIcons().add(new Image(this.getClass().getResourceAsStream("icon.png")));
        stage.show();
        ZoomRegionViewController zoomController = (ZoomRegionViewController) loader.getController();
        ArrayList<SnpFile> bothFiles = new ArrayList<>();
        bothFiles.addAll(affFiles);
        bothFiles.addAll(unFiles);
        ArrayList<Pane> zoomPanes = zoomController.setPanes(bothFiles);
        zoomController.setParentController(this);
        zoomController.setLoadingRectangle(rectangle);
        zoomController.setRegionLength(selectionWidth);
        zoomController.setRegionStart(startCoordinate);
        zoomController.setChromosome(currentChrom);
        SplitPane zoomSplit = zoomController.getSplitPane();
        Iterator<SnpFile> sIter = bothFiles.iterator();
        Iterator<Pane> pIter = zoomPanes.iterator();
        if (!sIter.hasNext() || !pIter.hasNext()) {
            return;
        }
        SnpFile firstFile = sIter.next();
        Pane firstPane = pIter.next();
        drawCoordinatesWithIterator(firstFile, firstPane, subPath, sIter, pIter, 1, bothFiles.size(),
                currentChrom, startCoordinate, startCoordinate + selectionWidth, true, zoomSplit);
        zoomController.tidyPanes();

    } catch (ChromosomeLength.ChromosomeLengthException | IOException ex) {
        Dialogs.showErrorDialog(null, "Please see details for stack trace.", "Error displaying zoomed region",
                "SnpViewer", ex);
    }
}