@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 ); } }
/** * init fxml when loaded. */ @PostConstruct public void init() { try { popup = new JFXPopup(FXMLLoader.load(getClass().getResource("/fxml/ui/popup/DemoPopup.fxml"))); } catch (IOException ioExc) { ioExc.printStackTrace(); } burger1.setOnMouseClicked((e) -> popup.show(rippler1, PopupVPosition.TOP, PopupHPosition.LEFT)); burger2.setOnMouseClicked((e) -> popup.show(rippler2, PopupVPosition.TOP, PopupHPosition.RIGHT)); burger3.setOnMouseClicked((e) -> popup.show(rippler3, PopupVPosition.BOTTOM, PopupHPosition.LEFT)); burger4.setOnMouseClicked((e) -> popup.show(rippler4, PopupVPosition.BOTTOM, PopupHPosition.RIGHT)); } }
public void showExportXPathToRuleWizard() { ExportXPathWizardController wizard = new ExportXPathWizardController(xpathExpressionProperty()); FXMLLoader loader = new FXMLLoader(getClass().getResource("fxml/xpath-export-wizard.fxml")); loader.setController(wizard); final Stage dialog = new Stage(); dialog.initOwner(designerRoot.getMainStage()); dialog.setOnCloseRequest(e -> wizard.shutdown()); dialog.initModality(Modality.WINDOW_MODAL); Parent root; try { root = loader.load(); } catch (IOException e) { throw new RuntimeException(e); } Scene scene = new Scene(root); //stage.setTitle("PMD Rule Designer (v " + PMD.VERSION + ')'); dialog.setScene(scene); dialog.show(); }
private Stage createStage(Stage mainStage) { FXMLLoader loader = new FXMLLoader(DesignerUtil.getFxml("event-log.fxml")); loader.setController(this); final Stage dialog = new Stage(); dialog.initOwner(mainStage.getScene().getWindow()); dialog.initModality(Modality.NONE); Parent root; try { root = loader.load(); } catch (IOException e) { throw new IllegalStateException(e); } Scene scene = new Scene(root); dialog.setScene(scene); return dialog; }
notification = loader.load(); } catch (final IOException ex) { throw new SpeedmentToolException(
stage.setScene(new Scene(fxmlLoader.load())); } catch (IOException e) { e.printStackTrace();
Parent root = loader.load(); Scene scene = new Scene(root);
private Stage createEditPropertyDialog() { EditPropertyDialogController wizard = new EditPropertyDialogController(); FXMLLoader loader = new FXMLLoader(DesignerUtil.getFxml("edit-property-dialog.fxml")); loader.setController(wizard); final Stage dialog = new Stage(); dialog.initOwner(this.getScene().getWindow()); dialog.initModality(Modality.WINDOW_MODAL); dialog.initStyle(StageStyle.UNDECORATED); Parent root; try { root = loader.load(); } catch (IOException e) { throw new IllegalStateException(e); } Scene scene = new Scene(root); dialog.setTitle("Edit property"); dialog.setScene(scene); dialog.setUserData(wizard); return dialog; }
Stage popup = new Stage(); FXMLLoader loader = new FXMLLoader(DesignerUtil.getFxml("generate-xpath-from-stack-trace.fxml")); Parent root = loader.load(); Button button = (Button) loader.getNamespace().get("generateButton"); TextArea area = (TextArea) loader.getNamespace().get("stackTraceArea");
toolbarPopup = new JFXPopup(loader.load());
/** * Loads and parses a fxml document. * * @param fxml * the stream containing the document * @param closeStream * close the stream after processing */ public void load(InputStream fxml, boolean closeStream) throws Exception { FXMLLoader loader = new FXMLLoader(); fxmlRoot = loader.load(fxml); if (closeStream) fxml.close(); }
/** * Loads FXML object from URL specified in constructor. * * @return valid JavaFX UI object * @throws IOException if an error occurs */ @Override public Object load() throws IOException { setResources(new DMXResourceBundle(resourceHnadler)); return super.load(fxmlFileUrl.openStream()); }
public WorldPane() { log.finest("constructing world pane"); FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("WorldPane.fxml")); fxmlLoader.setRoot(this); fxmlLoader.setController(this); try { fxmlLoader.load(); } catch (IOException exception) { throw new RuntimeException(exception); } }
public FailurePane() { getStyleClass().add("failure"); setMinWidth(220.0d); FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("FailurePane.fxml")); fxmlLoader.setRoot(this); fxmlLoader.setController(this); try { fxmlLoader.load(); } catch (IOException exception) { throw new RuntimeException(exception); } }
@Override public void run() { try { FXMLLoader loader = new FXMLLoader(getClass().getResource("Login.fxml")); loader.setController(controller); Parent root = (Parent) loader.load(); Scene scene = new Scene(root); fxPanel.setScene(scene); } catch (IOException ex) { Exceptions.printStackTrace(ex); } } });
FXMLLoader loadSynchronously(final URL resource, ResourceBundle bundle, final String conventionalName) throws IllegalStateException { final FXMLLoader loader = new FXMLLoader(resource, bundle); PresenterFactory factory = discover(); Callback<Class<?>, Object> controllerFactory = (Class<?> p) -> factory.instantiatePresenter(p, this.injectionContext); loader.setControllerFactory(controllerFactory); try { loader.load(); } catch (IOException ex) { throw new IllegalStateException("Cannot load " + conventionalName, ex); } return loader; }
/** * Loads an object hierarchy from a FXML document.<br> * * @param <T> the object's type * @param location the url * @return the object * @throws IOException if loading failed */ public static <T> T load(URL location) throws IOException { FXMLLoader loader = new FXMLLoader(location, null, FxFactory.getInstance().getBuilderFactory()); return loader.load(); }
/** * Loads an object hierarchy from a FXML document.<br> * * @param <T> the object's type * @param location the url * @param resources the optional resources * @return the object * @throws IOException if loading failed */ public static <T> T load(URL location, ResourceBundle resources) throws IOException { FXMLLoader loader = new FXMLLoader(location, resources, FxFactory.getInstance().getBuilderFactory()); return loader.load(); }
/** * Loads the <class name>.fxml file, which is expected to be in the same package as the specified type. * * @param loader the {@link FXMLLoader} * @param type the type * @return the loaded object * @throws IOException */ public static Object load(FXMLLoader loader, Class<?> type) throws IOException { try (InputStream is = getFXMLInputStream(type)) { if (is == null) { // avoid NullPointerException throw new ResourceFileNotFoundException(getAbsoluteFxmlResourcePath(type)); } return loader.load(is); } }
@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(); }