本文整理了Java中javafx.fxml.FXMLLoader.setResources()
方法的一些代码示例,展示了FXMLLoader.setResources()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FXMLLoader.setResources()
方法的具体详情如下:
包路径:javafx.fxml.FXMLLoader
类名称:FXMLLoader
方法名:setResources
暂无
代码示例来源:origin: org.drombler.fx/drombler-fx-core-commons
/**
* Creates a new {@link FXMLLoader}. <br/> <br/>
* Sets:
* <ul>
* <li>the {@link ClassLoader} to the ClassLoader of the specified type</li>
* <li>the {@link ResourceBundle} by looking for a {@code Bundle.properties} file in the package of the specified type (or a locale specific derivation) using the default {@link Locale}</li>
* </ul>
* @param type the type specifing the {@link ClassLoader} and the package of the {@code Bundle.properties} file
* @return a {@link FXMLLoader}
*/
public static FXMLLoader createFXMLLoader(Class<?> type) {
FXMLLoader loader = new FXMLLoader();
loader.setClassLoader(type.getClassLoader());
loader.setResources(Resources.getResourceBundle(type));
return loader;
}
/**
代码示例来源:origin: com.cathive.fx/fx-guice
final String resourcesString = annotation.resources();
if (!resourcesString.isEmpty()) {
fxmlLoader.setResources(ResourceBundle.getBundle(resourcesString));
代码示例来源: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: at.bestsolution.efxclipse.rt/org.eclipse.fx.osgi.util
loader.setLocation(url);
loader.setClassLoader(classloader);
loader.setResources(resourceBundle);
if (builderFactory == null) {
loader.setBuilderFactory(new JavaFXBuilderFactory(classloader));
代码示例来源: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.setLocation(url);
if (resources != null) {
loader.setResources(resources);
代码示例来源:origin: org.jrebirth.af/core
fxmlLoader.setResources(ResourceBundle.getBundle(bundlePath));
内容来源于网络,如有侵权,请联系作者删除!