@FXML
  public void ProductDetails() {

    try {
      URL location = getClass().getResource("proTableview.fxml");

      FXMLLoader fxmlLoader = new FXMLLoader();
      fxmlLoader.setLocation(location);
      fxmlLoader.setBuilderFactory(new JavaFXBuilderFactory());

      Parent root1 = (Parent) fxmlLoader.load(location.openStream());

      proTableViewController ctr = (proTableViewController) fxmlLoader.getController();

      Scene scene = new Scene(root1);

      RuwanBook.getStage().setTitle("Product Details");
      RuwanBook.getStage().setScene(scene);

      RuwanBook.getStage().show();

    } catch (IOException ex) {
      Logger.getLogger(SupplierController.class.getName()).log(Level.SEVERE, null, ex);
    }
  }
Пример #2
0
  public Parent load(String name) {

    URL location = FxmlLoader.class.getResource(name);
    fxmlLoader = new FXMLLoader();
    fxmlLoader.setLocation(location);
    fxmlLoader.setBuilderFactory(new JavaFXBuilderFactory());

    try {
      return (Parent) fxmlLoader.load(location.openStream());
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }
  private void createScene() {
    try {
      URL location = getClass().getResource("stackedareachart.fxml");
      FXMLLoader fxmlLoader = new FXMLLoader();
      fxmlLoader.setLocation(location);
      fxmlLoader.setBuilderFactory(new JavaFXBuilderFactory());

      Parent root = (Parent) fxmlLoader.load(location.openStream());
      chartFxPanel.setScene(new Scene(root));
      controller = (StackedAreaChartController) fxmlLoader.getController();

    } catch (IOException ex) {
      Exceptions.printStackTrace(ex);
    }
  }
  @Nullable
  protected Node loadFromFXML(@Nonnull String baseName) {
    requireNonBlank(baseName, "Argument 'baseName' must not be blank");
    if (baseName.endsWith(FXML_SUFFIX)) {
      baseName = stripFilenameExtension(baseName);
    }
    baseName = baseName.replace('.', '/');
    String viewName = baseName + FXML_SUFFIX;
    String styleName = baseName + ".css";

    URL viewResource = getResourceAsURL(viewName);
    if (viewResource == null) {
      return null;
    }

    FXMLLoader fxmlLoader = new FXMLLoader(viewResource);
    fxmlLoader.setResources(getApplication().getMessageSource().asResourceBundle());
    fxmlLoader.setBuilderFactory(
        new JavaFXBuilderFactory(getApplication().getApplicationClassLoader().get()));
    fxmlLoader.setClassLoader(getApplication().getApplicationClassLoader().get());
    fxmlLoader.setControllerFactory(klass -> getMvcGroup().getView());

    try {
      fxmlLoader.load();
    } catch (IOException e) {
      throw new GriffonException(e);
    }

    Parent node = fxmlLoader.getRoot();

    URL cssResource = getResourceAsURL(styleName);
    if (cssResource != null) {
      String uriToCss = cssResource.toExternalForm();
      node.getStylesheets().add(uriToCss);
    }

    return node;
  }