@Override public Node load(String name) { final FXMLLoader loader = fxmlLoader(); final String filename = FXML_PREFIX + name + FXML_SUFFIX; loader.setLocation(InjectionLoaderImpl.class.getResource(filename)); try { return loader.load(); } catch (final IOException ex) { throw new SpeedmentToolException( "Error! Could not find FXML-file: " + filename + ".", ex ); } }
/** * @param recognizer * the {@link RecognitionScreenView} */ public RecognitionScreenView(final Recognition recognizer) { super(recognizer); this.recognizer = recognizer; this.gestureLength = recognizer.getFrameLength(); // CREATE AND SET THE CONTROLLER. INIT THE BORDER PANE Platform.runLater(() -> { final FXMLLoader loader = new FXMLLoader(); loader.setController(this); loader.setLocation(this.getClass().getResource(FXMLScreens.HOME.getPath())); try { this.recorderPane = (BorderPane) loader.load(); } catch (final IOException e1) { e1.printStackTrace(); } }); RecognitionScreenView.LOG.getClass(); }
/** * */ @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); } }
/** * Load a content from an FXML definition */ protected Node loadFXML(URL fxmlLocation) { try { if (fxmlLocation != null) { final FXMLLoader fxmlLoader = new FXMLLoader(); fxmlLoader.setLocation(fxmlLocation); fxmlLoader.setController(this); fxmlLoader.setBuilderFactory(new JavaFXBuilderFactory()); return fxmlLoader.load(); } } catch (final IOException e) { e.printStackTrace(); } return null; }
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); } } });
@SuppressWarnings("null") @Override public Node getGraphicNode(URI uri) throws IOException { if( uri.isPlatformPlugin() ) { Bundle b = org.eclipse.core.runtime.Platform.getBundle(uri.segment(1)); if( b != null ) { StringBuilder sb = new StringBuilder(); for (int i = 2; i < uri.segmentCount(); i++) { if (sb.length() != 0) { sb.append("/"); //$NON-NLS-1$ } sb.append(uri.segment(i)); } FXMLLoader loader = new FXMLLoader(); loader.setClassLoader(b.adapt(BundleWiring.class).getClassLoader()); URL url = b.getResource(sb.toString()); loader.setLocation(url); return loader.load(); } else { throw new IOException("Unknown bundle '"+uri.segment(1)+"'"); //$NON-NLS-1$ //$NON-NLS-2$ } } else { return FXMLLoader.load(new URL(uri.toString())); } } }
/** * Load a content from an FXML definition */ public static Object loadFXML(URL fxmlLocation, Object controller) { Object result = null; try { Assert.notNull(fxmlLocation); Assert.notNull(controller); final FXMLLoader fxmlLoader = new FXMLLoader(); fxmlLoader.setLocation(fxmlLocation); fxmlLoader.setController(controller); fxmlLoader.setBuilderFactory(new JavaFXBuilderFactory()); result = fxmlLoader.load(); } catch (final Exception e) { e.printStackTrace(); throw new IllegalArgumentException(e); } return result; }
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 initLayout(final String layoutName) throws IOException { final FXMLLoader loader = new FXMLLoader(); loader.setLocation(ProjectGUI.class.getResource("view/" + layoutName + ".fxml")); if (layoutName.equals("RootLayout")) { this.root = (BorderPane) loader.load();
PrintTools.info(""+getClass().getName()); PrintTools.info(""+getClass().getResource(getClass().getName())); loader.setLocation(getClass().getResource(getClass().getSimpleName() + ".fxml")); loader.setLocation(getClass().getResource(getClass().getSimpleName() + ".fxml"));
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(); }
try { FXMLLoader fxmlLoader = new FXMLLoader(); fxmlLoader.setLocation(fxmlLocation); fxmlLoader.setController(this); fxmlLoader.setBuilderFactory(new JavaFXBuilderFactory());
/** * @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); }
@Override public void start(Stage primaryStage) throws Exception { FXMLLoader loader = new FXMLLoader(); loader.setLocation(getClass().getResource(getClass().getSimpleName() + ".fxml")); loader.setController(this); loader.load(); controller.setMainWindow(primaryStage); controller.enableNetworkProcessorClientProperty().set(true); controller.setLidarScanMessageConsumer(lidarScanLogViewer::renderLidarScanMessage); lidarScanLogViewer.start(); lidarScanLogWriterControlPaneController.initialize(controller, lidarScanLogViewer); lidarScanLogReaderControlPaneController.initialize(controller); View3DFactory view3dFactory = View3DFactory.createSubscene(); view3dFactory.addCameraController(); view3dFactory.addWorldCoordinateSystem(0.3); view3dFactory.attachSubSceneTo(centerPane); view3dFactory.addNodeToView(lidarScanLogViewer.getRoot()); primaryStage.setTitle(getClass().getSimpleName()); primaryStage.setScene(new Scene(mainPane, 600, 400)); primaryStage.show(); primaryStage.setOnCloseRequest(event -> stop()); }
loader.setLocation(ProjectGUI.class.getResource("view/NewProjLayoutFolder.fxml")); final AnchorPane pane = (AnchorPane) loader.load(); final Stage stage = new Stage();
@Override public void start(Stage primaryStage) throws Exception { FXMLLoader loader = new FXMLLoader(); loader.setLocation(getClass().getResource(getClass().getSimpleName() + ".fxml")); loader.setController(this); loader.load(); controller.setMainWindow(primaryStage); controller.enableNetworkProcessorClientProperty().set(true); controller.setLidarScanMessageConsumer(lidarScanLogViewer::renderLidarScanMessage); lidarScanLogViewer.start(); lidarScanLogWriterControlPaneController.initialize(controller, lidarScanLogViewer); lidarScanLogReaderControlPaneController.initialize(controller); View3DFactory view3dFactory = View3DFactory.createSubscene(); view3dFactory.addCameraController(); view3dFactory.addWorldCoordinateSystem(0.3); view3dFactory.attachSubSceneTo(centerPane); view3dFactory.addNodeToView(lidarScanLogViewer.getRoot()); primaryStage.setTitle(getClass().getSimpleName()); primaryStage.setScene(new Scene(mainPane, 600, 400)); primaryStage.show(); primaryStage.setOnCloseRequest(event -> stop()); }
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(); } }
FXMLLoader loader = new FXMLLoader(); loader.setController(this); loader.setLocation(getClass().getResource(getClass().getSimpleName() + ".fxml")); mainPane = loader.load();
loader.setLocation(url); if (resources != null) { loader.setResources(resources);
loader.setLocation(getClass().getResource(getClass().getSimpleName() + ".fxml"));