类javafx.scene.control.SkinBase源码实例Demo

下面列出了怎么用javafx.scene.control.SkinBase的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: bisq   文件: TooltipUtil.java
public static void showTooltipIfTruncated(SkinBase skinBase, Labeled labeled) {
    for (Object node : skinBase.getChildren()) {
        if (node instanceof Text) {
            String displayedText = ((Text) node).getText();
            String untruncatedText = labeled.getText();
            if (displayedText.equals(untruncatedText)) {
                if (labeled.getTooltip() != null) {
                    labeled.setTooltip(null);
                }
            } else if (untruncatedText != null && !untruncatedText.trim().isEmpty()) {
                final Tooltip tooltip = new Tooltip(untruncatedText);

                // Force tooltip to use color, as it takes in some cases the color of the parent label
                // and can't be overridden by class or id
                tooltip.setStyle("-fx-text-fill: -bs-rd-tooltip-truncated;");
                labeled.setTooltip(tooltip);
            }
        }
    }
}
 
源代码2 项目: dolphin-platform   文件: CssHelper.java
/**
 * Creates a StyleableObjectProperty instance that is parametrized by the given parameters. The property will be a <tt>SimpleStyleableObjectProperty</tt>. The returned property must be defined as a field in the Skin class of the given Control class.
 * @param metaData The CssMetaData instance
 * @param skin The Skin that contains the property field.
 * @param <S> Type of the Control
 * @param <V> value type of the property
 * @return a styleable property that can be used in the Skin of a Control
 *
 * @see SimpleStyleableObjectProperty
 */
public static <S extends Control, V> StyleableObjectProperty<V> createProperty(SkinPropertyBasedCssMetaData<S, V> metaData, SkinBase<S> skin) {
    return new SimpleStyleableObjectProperty<V>(metaData, skin, metaData.getPropertyName(), metaData.getInitialValue(skin.getSkinnable()));
}
 
 类所在包
 类方法
 同包方法