List of usage examples for javafx.fxml FXMLLoader load
public <T> T load() throws IOException
From source file:jp.ac.tohoku.ecei.sb.metabolome.lims.gui.MainWindowController.java
@FXML void onProgenesisCreateTemplate(ActionEvent event) { try {// www. j a va 2 s. c om 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:ExcelFx.FXMLDocumentController.java
@FXML private void Open(ActionEvent event) throws NullPointerException, IOException { System.out.println("-----------------------------------------------------------"); System.out.println("Pressed open Button "); File universityFile = new File("university.json"); File collegeFile = new File("college.json"); System.out.println("University File emty is " + String.valueOf(universityFile.length() == 0)); System.out.println("College File emty is " + String.valueOf(collegeFile.length() == 0)); //File codesFile = new File("codes.json"); if ((universityFile.exists()) && (collegeFile.exists()) /*&& (codesFile.exists())*/) { try {//from www . j a va 2s .c o m this.universityJson.jsonRead("university.json"); this.collegeJson.jsonRead("college.json"); //this.codesJson.jsonRead("codes.json"); this.jsonXLSXData.setAll(universityJson, collegeJson/*, codesJson*/); } catch (IOException | ParseException ex) { Alert alert = new Alert(Alert.AlertType.INFORMATION); alert.setTitle(""); alert.setHeaderText(" ? ? "); alert.setContentText(ex.toString()); alert.showAndWait(); Logger.getLogger(FXMLDocumentController.class.getName()).log(Level.SEVERE, null, ex); } } else { try { FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("FileOpenFXML.fxml")); this.fileOpenParent = (Parent) fxmlLoader.load(); Stage stage = new Stage(); stage.initModality(Modality.APPLICATION_MODAL); stage.initStyle(StageStyle.DECORATED); stage.setTitle(" "); stage.setScene(new Scene(this.fileOpenParent)); stage.showAndWait(); } catch (Exception e) { System.err.println(e); } this.jsonXLSXData.setAll(universityJson, collegeJson/*, codesJson*/); } FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("InitalData.fxml")); Parent root1 = (Parent) fxmlLoader.load(); Stage stage = new Stage(); stage.initModality(Modality.APPLICATION_MODAL); stage.initStyle(StageStyle.DECORATED); stage.setTitle(" "); stage.setScene(new Scene(root1)); stage.showAndWait(); setProgressBar(-1.); Task task = new Task<Void>() { @Override protected Void call() throws Exception { initaldata = (JsonWrite) root1.getUserData(); System.out.println("Inital Data empty is " + initaldata.isEmpty()); initaldata.setPage(String.valueOf(Integer.parseInt(initaldata.getPage()) - 1)); Parser parser = new Parser(); list = parser.parseInitalData(initaldata.getPatch(), Integer.parseInt(initaldata.getPage())); //System.out.println(list.size()); Sort sort = new Sort(list, jsonXLSXData, initaldata.getYStart(), initaldata.getYEnd()); HashMap<String, HashMap<String, ArrayList<String>>> hm = sort .professionsGrouping(initaldata.getYStart(), initaldata.getYEnd()); sortProf = sort.addWay(hm); return null; } }; mainProcessing(task); System.out.println("button open finished"); System.out.println("-----------------------------------------------------------"); }
From source file:net.sourceforge.pmd.util.fxdesigner.XPathPanelController.java
public void showExportXPathToRuleWizard() throws IOException { ExportXPathWizardController wizard = new ExportXPathWizardController(xpathExpressionProperty()); FXMLLoader loader = new FXMLLoader(getClass().getResource("fxml/xpath-export-wizard.fxml")); loader.setController(wizard);/*w w w .j a v a 2 s.c om*/ final Stage dialog = new Stage(); dialog.initOwner(designerRoot.getMainStage()); dialog.setOnCloseRequest(e -> wizard.shutdown()); dialog.initModality(Modality.WINDOW_MODAL); Parent root = loader.load(); Scene scene = new Scene(root); //stage.setTitle("PMD Rule Designer (v " + PMD.VERSION + ')'); dialog.setScene(scene); dialog.show(); }
From source file:calendarioSeries.vistas.MainViewController.java
public void populateImagenes() { Platform.runLater(new Runnable() { @Override/*from w ww. j a va2 s. com*/ 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:investiagenofx2.view.InvestiaGenOFXController.java
private void showInvestmentsSummary(String accountType, Double x, Double y) { try {// ww w .j a v a 2 s. c o 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:investiagenofx2.view.InvestiaGenOFXController.java
private void linkAccountTransac(String linkAccountTransac) { try {/*from ww w . j av a 2 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 {/*from w w w .ja va 2s. 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 www .j ava2 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 ww w .ja 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; }