public static void addToParent(Parent parent) { parent.getStylesheets().add(IconFonts.class.getResource("fonts.css").toExternalForm()); } }
public static void addToNode(Parent node ){ node.getStylesheets().add(CssUtil.class.getResource("/de/factoryfx/javafx/css/app.css").toExternalForm()); }
void addCSSIfAvailable(Parent parent) { URL uri = getClass().getResource(getStyleSheetName()); if (uri == null) { return; } String uriToCss = uri.toExternalForm(); parent.getStylesheets().add(uriToCss); }
/** * 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); }
/** * 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); } } } }
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); }
result.addAll(((Parent) n).getStylesheets()); result.addAll(p.getStylesheets());
@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; }
view.getStylesheets().add(cssUrl.toExternalForm());