void initializeFXMLLoader() { if (this.fxmlLoader == null) { this.fxmlLoader = this.loadSynchronously(resource, bundle, bundleName); this.presenterProperty.set(this.fxmlLoader.getController()); } }
/** * Ensure fxml loader initialized. */ private void ensureFxmlLoaderInitialized() { if (fxmlLoader != null) { return; } fxmlLoader = loadSynchronously(resource, bundle); presenterProperty.set(fxmlLoader.getController()); }
@Override public void start(Stage stage) throws Exception { FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/Scene.fxml")); Parent root = loader.load(); Scene scene = new Scene(root); scene.getStylesheets().add("/styles/Styles.css"); stage.setTitle("Pose List 3D Plot"); stage.setScene(scene); FXMLController controller = loader.getController(); controller.setStage(stage); stage.show(); }
/** * */ @FXML public void clickNext() { final FXMLLoader loader = new FXMLLoader(); loader.setLocation(ProjectGUI.class.getResource("view/NewProjLayoutSelect.fxml")); try { final AnchorPane pane = (AnchorPane) loader.load(); final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); final double width = screenSize.getWidth() * 20.83 / 100; final double height = screenSize.getHeight() * 13.89 / 100; final Scene scene = new Scene(pane, width, height); this.stage.setScene(scene); final NewProjLayoutSelectController ctrl = loader.getController(); ctrl.setFolderPath(this.path); ctrl.setMain(this.main); ctrl.setStage(this.stage); } catch (IOException e) { L.error("Error loading the graphical interface. This is most likely a bug.", e); System.exit(1); } }
if (layoutName.equals("TopLayout")) { this.root.setTop(pane); this.controllerTop = loader.getController(); this.controllerTop.setMain(this); this.controllerTop.setCtrlLeft(this.controllerLeft); } else if (layoutName.equals("LeftLayout")) { this.root.setLeft(pane); this.controllerLeft = loader.getController(); this.controllerLeft.setMain(this); } else { this.root.setCenter(pane); this.controllerCenter = loader.getController(); this.controllerCenter.setMain(this); this.controllerCenter.setCtrlLeft(this.controllerLeft);
public void run() { // Parent root; try { // root = FXMLLoader.load(getClass().getResource("/eu/agrosense/client/grid/impl/GridPropertiesElement.fxml")); // Scene scene = new Scene(root); // fxPanel.setScene(scene); String fxml = "GridPropertiesElement.fxml"; FXMLLoader loader = new FXMLLoader(); InputStream in = GridPropertiesElement.class.getResourceAsStream(fxml); loader.setBuilderFactory(new JavaFXBuilderFactory()); loader.setLocation(GridPropertiesElement.class.getResource(fxml)); AnchorPane page; try { page = (AnchorPane) loader.load(in); } finally { in.close(); } Scene scene = new Scene(page, 800, 600); fxPanel.setScene(scene); controller = loader.getController(); controller.setGrid(gridDataObject.getLookup().lookup(Grid.class)); } catch (IOException ex) { Exceptions.printStackTrace(ex); } } });
private void newFile(final String extension) { try { final FXMLLoader loader = new FXMLLoader(); loader.setLocation(ProjectGUI.class.getResource("view/FileNameDialog.fxml")); final AnchorPane pane = (AnchorPane) loader.load(); final Stage stage = new Stage(); stage.setTitle(RESOURCES.getString("file_name_title")); stage.initModality(Modality.WINDOW_MODAL); stage.initOwner(this.main.getStage()); stage.setResizable(false); final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); final double width = screenSize.getWidth() * 20.83 / 100; final double height = screenSize.getHeight() * 13.89 / 100; final Scene scene = new Scene(pane, width, height); stage.setScene(scene); final FileNameDialogController controller = loader.getController(); controller.setDialogStage(stage); controller.setExtension(extension); controller.setCtrlLeftLayout(this.ctrlLeft); stage.showAndWait(); } catch (IOException e) { L.error("Error loading the graphical interface. This is most likely a bug.", e); System.exit(1); } }
private void loadLayout(final boolean isFolder) { final FXMLLoader loader = new FXMLLoader(); loader.setLocation(ProjectGUI.class.getResource("view/NewFolderOrFileDialog.fxml")); AnchorPane pane; try { pane = (AnchorPane) loader.load(); } catch (IOException e) { throw new IllegalStateException(e); } final Stage stage = new Stage(); if (isFolder) { stage.setTitle(RESOURCES.getString("folder_name_title")); } else { stage.setTitle(RESOURCES.getString("file_name_title")); } stage.initModality(Modality.WINDOW_MODAL); stage.initOwner(this.main.getStage()); stage.setResizable(false); final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); final double width = screenSize.getWidth() * 20.83 / 100; final double height = screenSize.getHeight() * 13.89 / 100; final Scene scene = new Scene(pane, width, height); stage.setScene(scene); final NewFolderOrFileDialogController controller = loader.getController(); controller.initialize(isFolder); controller.setSelectedItem(this.selectedFile); controller.setStage(stage); stage.showAndWait(); }
/** * load me from the given fxml fileName * * @param fxmlFileName * @return the load Result */ public <T> LoadResult<T> load(String fxmlFileName) { try { LoadResult<T> loadResult = new LoadResult<T>(); ResourceBundle resourceBundle = Translator.getBundle(); URL fxml = JFXWizardPane.class .getResource(resourcePath + fxmlFileName + ".fxml"); FXMLLoader fxmlLoader = new FXMLLoader(fxml, resourceBundle); loadResult.parent = fxmlLoader.load(); loadResult.setController(fxmlLoader.getController()); return loadResult; } catch (Throwable th) { ErrorHandler.handle(th); } return null; }
O value = loader.load(stream); if (value != null) { return new FXMLData<O, C>(value, (C) loader.getController()); O value = loader.load(in); if (value != null) { return new FXMLData<O, C>(value, (C) loader.getController());
public void openNetworkSettings() { final FXMLLoader settings = FXUtil.load(SettingsController.class); try { final Node node = settings.load(); final SettingsController controller = settings.getController(); final Stage stage = new Stage(); final Scene scene = new Scene(new Group(node)); stage.setTitle("Network Settings"); stage.setScene(scene); stage.initModality(Modality.APPLICATION_MODAL); controller.setOnClose(e -> stage.close()); stage.show(); } catch (IOException ex) { Logger.getLogger(BrowserFXController.class.getName()).log(Level.SEVERE, "Unable to open settings", ex); } }
/** * @throws IOException * if the XML can not get loaded */ @FXML public void clickBack() throws IOException { final FXMLLoader loader = new FXMLLoader(); loader.setLocation(ProjectGUI.class.getResource("view/NewProjLayoutFolder.fxml")); final AnchorPane pane = (AnchorPane) loader.load(); final Scene scene = new Scene(pane); this.stage.setScene(scene); final NewProjLayoutFolderController ctrl = loader.getController(); ctrl.setMain(this.main); ctrl.setStage(this.stage); ctrl.setFolderPath(this.folderPath); }
final Scene scene = new Scene(pane, width, height); stage.setScene(scene); final NewProjLayoutFolderController ctrl = loader.getController(); ctrl.setMain(this.main); ctrl.setStage(stage);
public void initFX(JFXPanel fxPanel) { // Init the root layout try { FXMLLoader loader = new FXMLLoader(); loader.setLocation(MainAppFrame.class.getResource("/sc/fiji/omevisual/gui/view/RootLayout.fxml")); AnchorPane rootLayout = (AnchorPane) loader.load(); // Get the controller and add an ImageJ context to it. RootLayoutController controller = loader.getController(); controller.setContext(ij.context()); controller.setImage(this.image); // Show the scene containing the root layout. Scene scene = new Scene(rootLayout); this.fxPanel.setScene(scene); // Resize the JFrame to the JavaFX scene this.setSize((int) scene.getWidth(), (int) scene.getHeight()); controller.fill(md); } catch (IOException e) { e.printStackTrace(); } }
final FXMLController<M, ?> fxmlController = (FXMLController<M, ?>) fxmlLoader.getController(); if (!error && !(fxmlLoader.getController() instanceof AbstractFXMLController)) { throw new CoreRuntimeException(BAD_FXML_CONTROLLER_ANCESTOR.getText(fxmlLoader.getController().getClass().getCanonicalName()));
@Override public void start(Stage stage) throws Exception { FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("browser.fxml")); Parent root = (Parent) fxmlLoader.load(); stage.getIcons().addAll( new Image("/webfx/browser/icons/globe_16.png", 16, 16, true, true), new Image("webfx/browser/icons/globe_32.png", 32, 32, true, true), new Image("webfx/browser/icons/globe_64.png", 64, 64, true, true) ); BrowserFXController controller = fxmlLoader.getController(); controller.setLocale(getCurrentLocale()); Scene scene = new Scene(root); BrowserShortcuts shortcuts = new BrowserShortcuts(scene); shortcuts.setup(controller); stage.setTitle("WebFX Browser"); stage.setScene(scene); stage.show(); }
controller = loader.getController(); controller.setView(view); if (view instanceof FxContainer) {
result.location.set(loader.getLocation()); result.resources.set(loader.getResources()); result.controller.set(loader.getController()); result.root.set(root); result.charset.set(loader.getCharset());