javafx.fxml.FXMLLoader.setBuilderFactory()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(114)

本文整理了Java中javafx.fxml.FXMLLoader.setBuilderFactory()方法的一些代码示例,展示了FXMLLoader.setBuilderFactory()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FXMLLoader.setBuilderFactory()方法的具体详情如下:
包路径:javafx.fxml.FXMLLoader
类名称:FXMLLoader
方法名:setBuilderFactory

FXMLLoader.setBuilderFactory介绍

暂无

代码示例

代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine

/**
 * 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;
}

代码示例来源:origin: eu.agrosense.client/grid-api

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);
        }
      }
    });

代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine

/**
 * 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;
}

代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.osgi.util

loader.setResources(resourceBundle);
if (builderFactory == null) {
  loader.setBuilderFactory(new JavaFXBuilderFactory(classloader));
} else {
  loader.setBuilderFactory(new BuilderFactory() {
    private JavaFXBuilderFactory orgBuilder = new JavaFXBuilderFactory(classloader);

代码示例来源:origin: io.datafx/flow

private FXMLLoader createLoader(final Object controller, String fxmlName, ViewConfiguration viewConfiguration)
    throws FxmlLoadException {
  Class<?> controllerClass = controller.getClass();
  String foundFxmlName = getFxmlName(controllerClass);
  if (fxmlName != null) {
    foundFxmlName = fxmlName;
  }
  if (foundFxmlName == null) {
    throw new FxmlLoadException("No FXML File specified!");
  }
  FXMLLoader fxmlLoader = new FXMLLoader(
      controllerClass.getResource(foundFxmlName));
  fxmlLoader.setBuilderFactory(viewConfiguration.getBuilderFactory());
  fxmlLoader.setCharset(viewConfiguration.getCharset());
  fxmlLoader.setResources(viewConfiguration.getResources());
  fxmlLoader.setController(controller);
  fxmlLoader.setControllerFactory(c -> controller);
  return fxmlLoader;
}

代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-preloader

fxmlLoader.setLocation(fxmlLocation);
fxmlLoader.setController(this);
fxmlLoader.setBuilderFactory(new JavaFXBuilderFactory());
fxmlLoader.load();

代码示例来源:origin: org.javafxdata/datafx-controller

private FXMLLoader createLoader(final Object controller, String fxmlName, ViewConfiguration viewConfiguration)
    throws FxmlLoadException {
  Class<?> controllerClass = controller.getClass();
  String foundFxmlName = getFxmlName(controllerClass);
  if (fxmlName != null) {
    foundFxmlName = fxmlName;
  }
  if (foundFxmlName == null) {
    throw new FxmlLoadException("No FXML File specified!");
  }
  FXMLLoader fxmlLoader = new FXMLLoader(
      controllerClass.getResource(foundFxmlName));
  fxmlLoader.setBuilderFactory(viewConfiguration.getBuilderFactory());
  fxmlLoader.setCharset(viewConfiguration.getCharset());
  fxmlLoader.setResources(viewConfiguration.getResources());
  fxmlLoader.setController(controller);
  fxmlLoader.setControllerFactory(new Callback<Class<?>, Object>() {
    @Override
    public Object call(Class<?> arg0) {
      return controller;
    }
  });
  return fxmlLoader;
}

代码示例来源:origin: org.codehaus.griffon/griffon-javafx

protected void configureFxmlLoader(@Nonnull FXMLLoader fxmlLoader) {
  fxmlLoader.setBuilderFactory(new GriffonBuilderFactory(getApplication(), getMvcGroup()));
  fxmlLoader.setResources(getApplication().getMessageSource().asResourceBundle());
  fxmlLoader.setClassLoader(getApplication().getApplicationClassLoader().get());
  fxmlLoader.setControllerFactory(klass -> getMvcGroup().getView());
}

代码示例来源:origin: com.cathive.fx/fx-guice

loader.setResources(resources);
loader.setBuilderFactory(injector.getInstance(FXMLComponentBuilderFactory.class));
loader.setControllerFactory(new Callback<Class<?>, Object>() {
  @Override

相关文章