本文整理了Java中javafx.fxml.FXMLLoader.getRoot()
方法的一些代码示例,展示了FXMLLoader.getRoot()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FXMLLoader.getRoot()
方法的具体详情如下:
包路径:javafx.fxml.FXMLLoader
类名称:FXMLLoader
方法名:getRoot
暂无
代码示例来源:origin: de.roskenet/springboot-javafx-support
/**
* Initializes the view by loading the FXML (if not happened yet) and
* returns the top Node (parent) specified in the FXML file.
*
* @return the root view as determined from {@link FXMLLoader}.
*/
public Parent getView() {
ensureFxmlLoaderInitialized();
final Parent parent = fxmlLoader.getRoot();
addCSSIfAvailable(parent);
return parent;
}
代码示例来源:origin: com.airhacks/afterburner.fx
/**
* Initializes the view by loading the FXML (if not happened yet) and
* returns the top Node (parent) specified in
*
* @return the node loaded by FXMLLoader
*/
public Parent getView() {
this.initializeFXMLLoader();
Parent parent = fxmlLoader.getRoot();
addCSSIfAvailable(parent);
return parent;
}
代码示例来源:origin: org.codehaus.griffon/griffon-javafx
@Nonnull
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) {
throw new IllegalStateException("resource " + viewName + " not found");
}
FXMLLoader fxmlLoader = createFxmlLoader(viewResource);
configureFxmlLoader(fxmlLoader);
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;
}
内容来源于网络,如有侵权,请联系作者删除!