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:spdxedit.license.LicenseEditControl.java

public Pane getUi() {
    try {//from w ww .  ja va2 s  .  c om
        FXMLLoader loader = new FXMLLoader(LicenseEditControl.class.getResource("/LicenseEdit.fxml"));
        loader.setController(this);
        Pane pane = loader.load();
        return pane;
    } catch (IOException ioe) {
        throw new RuntimeException("Unable to load scene for License editor dialog");
    }
}

From source file:jp.ac.tohoku.ecei.sb.metabolome.lims.gui.MainWindowController.java

@FXML
void onProgenesisCreateTemplate(ActionEvent event) {
    try {// w w  w  . j a  v a2s  . com
        FXMLLoader loader = new FXMLLoader(getClass().getResource("progenesis/createtemplate.fxml"));
        loader.load();
        Parent root = loader.getRoot();
        Stage stage = new Stage();
        stage.setScene(new Scene(root));

        TemplateCreatorController controller = loader.getController();
        controller.setMainWindowController(this);
        controller.setStage(stage);
        stage.setTitle("Create Sample Info Template from Progenesis Output");
        stage.show();
    } catch (IOException e) {
        e.printStackTrace();
    }
}

From source file:org.sleuthkit.autopsy.imageanalyzer.gui.MetaDataPane.java

public MetaDataPane(ImageAnalyzerController controller) {
    this.controller = controller;

    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("MetaDataPane.fxml"));
    fxmlLoader.setRoot(this);
    fxmlLoader.setController(this);

    try {/*from   ww w .  j  av a 2 s .c om*/
        fxmlLoader.load();
    } catch (IOException exception) {
        throw new RuntimeException(exception);
    }
}

From source file:aajavafx.Schedule1Controller.java

@FXML
private void handleGoBack(ActionEvent event) {

    try {/*from ww  w .  j a  v  a2 s . c o m*/
        Node node = (Node) event.getSource();
        Stage stage = (Stage) node.getScene().getWindow();
        FXMLLoader loader = new FXMLLoader(getClass().getResource("MainPage.fxml"));
        Parent root = loader.load();
        Scene scene = new Scene(root, 879, 599);
        stage.setScene(scene);

        stage.setTitle("Main menu");
        stage.show();

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

From source file:calendarioSeries.vistas.MainViewController.java

public void populateImagenes() {
    Platform.runLater(new Runnable() {
        @Override/* w  w w.  j  a  va  2  s  .  c  o m*/
        public void run() {
            imagenes.getChildren().clear();
            for (Serie serie : series) {
                //System.out.println(serie.getLastVisto());
                try {
                    Image image = new Image(serie.getUrlImagen());
                    ImageView poster = new ImageView();
                    ContextMenu menu = new ContextMenu();
                    //String css = MainApp.class.getResource("resources/MainTheme.css").toExternalForm();
                    MenuItem delete = new MenuItem("Eliminar");
                    delete.setId(serie.getId());
                    delete.setOnAction(new EventHandler<ActionEvent>() {
                        @Override
                        public void handle(ActionEvent event) {
                            menu.hide();
                            MenuItem clicked = (MenuItem) event.getSource();
                            String toDelete = clicked.getId();
                            for (Serie serie : series) {
                                if (serie.getId().equals(toDelete)) {
                                    series.remove(serie);
                                    populateImagenes();
                                    showDetallesMes(mesActual);
                                }
                            }
                            event.consume();
                        }
                    });

                    menu.getItems().add(delete);

                    poster.setId(serie.getTitulo());
                    poster.setImage(image);
                    poster.setCache(true);
                    // poster.setPreserveRatio(true);
                    poster.setFitWidth(210);
                    poster.setFitHeight(300);
                    poster.setOnContextMenuRequested(new EventHandler<ContextMenuEvent>() {
                        @Override
                        public void handle(ContextMenuEvent event) {
                            menu.show(poster, event.getScreenX(), event.getScreenY());
                            //menu.getScene().getRoot().getStylesheets().add(css);
                            event.consume();
                        }
                    });
                    poster.setOnMouseClicked(new EventHandler<MouseEvent>() {
                        @Override
                        public void handle(MouseEvent event) {
                            if (event.getButton() == MouseButton.PRIMARY) {
                                try {
                                    //serieToPass = serie;
                                    sceneToPass = mainApp.scene;

                                    FXMLLoader loader = new FXMLLoader(
                                            getClass().getResource("DetailsSerieController.fxml"));
                                    Parent root = loader.load();
                                    DetailsSerieController controller = loader.getController();
                                    controller.setData(serie, series);
                                    controller.setMainApp(mainApp);

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

                    });
                    imagenes.getChildren().add(poster);
                } catch (IllegalArgumentException e) {
                    Image image = new Image("file:src/calendarioSeries/resources/no-image.png");
                    ImageView poster = new ImageView();
                    ContextMenu menu = new ContextMenu();
                    MenuItem delete = new MenuItem("Eliminar");
                    delete.setId(serie.getId());
                    delete.setOnAction(new EventHandler<ActionEvent>() {
                        @Override
                        public void handle(ActionEvent event) {
                            menu.hide();
                            MenuItem clicked = (MenuItem) event.getSource();
                            String toDelete = clicked.getId();
                            for (Serie serie : series) {
                                if (serie.getId().equals(toDelete)) {
                                    series.remove(serie);
                                    populateImagenes();
                                    showDetallesMes(mesActual);
                                }
                            }
                            event.consume();
                        }
                    });

                    menu.getItems().add(delete);

                    poster.setId(serie.getTitulo());
                    poster.setImage(image);
                    poster.setCache(true);
                    //poster.setPreserveRatio(true);
                    poster.setFitWidth(210);
                    poster.setFitHeight(300);
                    poster.setOnContextMenuRequested(new EventHandler<ContextMenuEvent>() {
                        @Override
                        public void handle(ContextMenuEvent event) {
                            menu.show(poster, event.getScreenX(), event.getScreenY());
                            event.consume();
                        }
                    });
                    Text text = new Text(serie.getTitulo());
                    text.getStyleClass().add("label");
                    StackPane pane = new StackPane();
                    pane.getChildren().addAll(poster, text);

                    imagenes.getChildren().add(pane);
                } finally {
                    rellenarArchivo();
                }
            }
        }
    });

}

From source file:view.FXApplicationController.java

public FXApplicationController(DataController dataController, FeatureModel featureModel, FXViewModel viewModel,
        boolean recreateModelMode) {

    primaryStage = new Stage();

    // Creating FXML Loader
    FXMLLoader loader = new FXMLLoader(FXStartController.class.getResource("Application.fxml"));
    loader.setController(this);

    // Try to load fxml file
    try {// w  w w.  ja  v  a  2s.c o  m
        mainGrid = loader.load();
    } catch (IOException e) {
        Logger.getLogger(this.getClass().getName()).log(Level.SEVERE,
                "Error during loading Application.fxml file!", e);
    }

    this.dataController = dataController;
    this.dataModel = dataController.getDataModel();

    //initialize important variables
    channelNames = dataModel.getChannelNames();
    displayBuffer = dataModel.data.clone();
    // Set Choice Box for the channels        
    //Set properties for the channels
    for (int i = 0; i < channelNames.length; i++) {
        if (i < 6) {
            //The first value represents wheater the channel is shown
            //The second value represents the current zoom level
            Double[] channelProp = new Double[2];
            channelProp[0] = 1.0;
            channelProp[1] = 1.0;
            allChannels.put(channelNames[i], channelProp);
        } else {
            //The first value represents wheater the channel is shown
            //The second value represents the current zoom level
            Double[] channelProp = new Double[2];
            channelProp[0] = 0.0;
            channelProp[1] = 1.0;
            allChannels.put(channelNames[i], channelProp);
        }

    }

    // Create stage with mainGrid
    scene = new Scene(mainGrid);
    primaryStage.setScene(scene);

    //Properties for stage
    primaryStage.setResizable(true);
    primaryStage.show();
    primaryStage.setTitle(dataModel.getFile().getName());

    ////////////
    this.viewModel = viewModel;
    this.featureModel = featureModel;
    this.featureController = new FeatureController(featureModel, dataModel);

    this.recreateModelMode = recreateModelMode;

    kcDetector = featureController.kcDetector;
    kcDetector.setHighpassCoefficients(featureController.getDisplayHighpassCoefficients());
    kcDetector.setLowpassCoefficients(featureController.getLowpassCoefficients());

    currentEpoch = featureModel.getCurrentEpoch();
    loadEpoch(currentEpoch);
    showEpoch();

    paintSpacing();

    //Configure lineChart
    lineChart.setSnapToPixel(false);

    choices = FXCollections.observableArrayList();
    updateChoiceBox();
    choiceBox.getSelectionModel().select(0);

    ObservableList<String> choicesModel = FXCollections.observableArrayList();

    File folder = new File("./Classifiers").getAbsoluteFile();
    for (File file : folder.listFiles()) {
        if (file.getName().contains("model")) {
            choicesModel.add(file.getName().replace("[model]", "").replace(".jo", ""));
            classifierList.add(file.getAbsolutePath());
        }
    }

    choiceBoxModel.setItems(choicesModel);
    choiceBoxModel.getSelectionModel().select(0);

    tooltips();

    scatterPlot = new FXScatterPlot(this, dataController, dataModel, featureModel, featureController,
            viewModel);
    hypnogram = new FXHypnogrammController(dataModel, featureModel, viewModel, this);

    Platform.runLater(new Runnable() {
        @Override
        public void run() {
            if (recreateModelMode) {
                hypnogram.updateAll();
                hypnogram.hide();
            }
            updateWindows();
        }
    });

    if (((int) (dataModel.getSrate()) % 50) != 0) {
        showPopUp("Sampling rate not supported. Must be a multiple of 50 Hz and > 100 Hz.");
    }
}

From source file:ExcelFx.FXMLDocumentController.java

@FXML
private void TablePatch(ActionEvent event) throws IOException {
    System.out.println("ExcelFx.FXMLDocumentController.TablePatch()");
    try {//from   w  ww .ja v  a 2s  . co m
        FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("FileOpenFXML.fxml"));
        Parent root1 = (Parent) fxmlLoader.load();
        Stage stage = new Stage();
        stage.initModality(Modality.WINDOW_MODAL);
        stage.initStyle(StageStyle.DECORATED);
        stage.setTitle(" ");
        stage.setScene(new Scene(root1));
        stage.show();
    } catch (Exception e) {
        System.err.println(e);

    }

}

From source file:jp.ac.tohoku.ecei.sb.metabolome.lims.gui.MainWindowController.java

@FXML
void onProgenesisImport(ActionEvent event) {
    try {//w ww . j a  v a 2 s  .c  o m
        FXMLLoader loader = new FXMLLoader(getClass().getResource("progenesis/importer.fxml"));
        loader.load();
        Parent root = loader.getRoot();
        Stage stage = new Stage();
        stage.setScene(new Scene(root));

        ProgenesisImporterController controller = loader.getController();
        controller.setMainWindowController(this);
        controller.setStage(stage);
        stage.setTitle("Import data from Progenesis CSV and Sample Info Excel");
        stage.show();
    } catch (IOException e) {
        e.printStackTrace();
    }
}

From source file:analyzer.code.FXMLAnalyzerController.java

@FXML
private void settingMunuItem() throws FileNotFoundException, IOException {
    FXMLLoader loader = new FXMLLoader(getClass().getResource("FXMLSetting.fxml"));
    try {/*from   w  w  w .  j  av a 2  s  .c om*/
        AnchorPane pane = (AnchorPane) loader.load();
        fxmlsc = loader.getController();
        fxmlsc.setAnalyzer(this);
        Scene scene = new Scene(pane);
        Stage stage = new Stage();
        stage.setScene(scene);
        stage.setTitle("??");
        stage.show();
    } catch (Exception e) {
        e.printStackTrace();
    }
}