本文整理了Java中javafx.scene.Parent.getStylesheets()
方法的一些代码示例,展示了Parent.getStylesheets()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Parent.getStylesheets()
方法的具体详情如下:
包路径:javafx.scene.Parent
类名称:Parent
方法名:getStylesheets
暂无
代码示例来源:origin: com.guigarage/ui-basics
public static void addToParent(Parent parent) {
parent.getStylesheets().add(IconFonts.class.getResource("fonts.css").toExternalForm());
}
}
代码示例来源:origin: io.github.factoryfx/javafxDataEditing
public static void addToNode(Parent node ){
node.getStylesheets().add(CssUtil.class.getResource("/de/factoryfx/javafx/css/app.css").toExternalForm());
}
代码示例来源:origin: com.airhacks/afterburner.fx
void addCSSIfAvailable(Parent parent) {
URL uri = getClass().getResource(getStyleSheetName());
if (uri == null) {
return;
}
String uriToCss = uri.toExternalForm();
parent.getStylesheets().add(uriToCss);
}
代码示例来源:origin: de.roskenet/springboot-javafx-support
/**
* Adds the CSS if available.
*
* @param parent
* the parent
*/
void addCSSIfAvailable(final Parent parent) {
// Read global css when available:
final List<String> list = PropertyReaderHelper.get(applicationContext.getEnvironment(), "javafx.css");
if (!list.isEmpty()) {
list.forEach(css -> parent.getStylesheets().add(getClass().getResource(css).toExternalForm()));
}
addCSSFromAnnotation(parent);
final URL uri = getClass().getResource(getStyleSheetName());
if (uri == null) {
return;
}
final String uriToCss = uri.toExternalForm();
parent.getStylesheets().add(uriToCss);
}
代码示例来源:origin: de.roskenet/springboot-javafx-support
/**
* Adds the CSS from annotation to parent.
*
* @param parent
* the parent
* @param annotation
* the annotation
*/
private void addCSSFromAnnotation(final Parent parent) {
if (annotation != null && annotation.css().length > 0) {
for (final String cssFile : annotation.css()) {
final URL uri = getClass().getResource(cssFile);
if (uri != null) {
final String uriToCss = uri.toExternalForm();
parent.getStylesheets().add(uriToCss);
LOGGER.debug("css file added to parent: {}", cssFile);
} else {
LOGGER.warn("referenced {} css file could not be located", cssFile);
}
}
}
}
代码示例来源:origin: com.cedarsoft.commons/javafx
private InfoPopup(@Nonnull String message) {
setAutoHide(true);
setAutoFix(true);
Parent root = createContent(message);
root.getStylesheets().add(getClass().getResource("InfoPopupService.css").toExternalForm());
root.getStyleClass().add("sick-uiglv2");
root.getStyleClass().add("info-popup");
getContent().add(root);
}
代码示例来源:origin: eu.mihosoft.vrl.workflow/vworkflows-fx
result.addAll(((Parent) n).getStylesheets());
result.addAll(p.getStylesheets());
代码示例来源: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;
}
代码示例来源:origin: org.tentackle/tentackle-fx
view.getStylesheets().add(cssUrl.toExternalForm());
内容来源于网络,如有侵权,请联系作者删除!