List of usage examples for javafx.fxml FXMLLoader setLocation
public void setLocation(URL location)
From source file:UI.MainStageController.java
/** * Opens new PopUp Window with Image Export options. */// w w w . j a va 2 s .c o m @FXML private void exportImages() { try { FXMLLoader loader = new FXMLLoader(getClass().getResource("src/UI/exportImageGUI")); loader.setLocation( new URL("file:" + new File("").getCanonicalPath().concat("/src/UI/exportImageGUI.fxml"))); //Parent root = loader.load(); ExportImageController exportImageController = new ExportImageController(viewPane); //ExportImageController exportImageController = loader.getController(); //exportImageController.setViewPane(viewPane); loader.setController(exportImageController); Parent root = loader.load(); exportImagesStage = new Stage(); exportImagesStage.setTitle("Export Image"); Scene exportImageScene = new Scene(root, 300, 200); exportImagesStage.setScene(exportImageScene); exportImageScene.getStylesheets().add(GlobalConstants.DARKTHEME); exportImagesStage.show(); } catch (Exception e) { e.printStackTrace(); } }
From source file:UI.MainStageController.java
@FXML /**/* w w w.ja va 2s .co 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(); }