当前位置: 首页>>代码示例>>Java>>正文


Java StringPropertyBase类代码示例

本文整理汇总了Java中javafx.beans.property.StringPropertyBase的典型用法代码示例。如果您正苦于以下问题:Java StringPropertyBase类的具体用法?Java StringPropertyBase怎么用?Java StringPropertyBase使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


StringPropertyBase类属于javafx.beans.property包,在下文中一共展示了StringPropertyBase类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Btn

import javafx.beans.property.StringPropertyBase; //导入依赖的package包/类
public Btn(final String TEXT) {
    getStyleClass().setAll("btn");
    rounded     = new BooleanPropertyBase(false) {
        @Override public Object getBean() { return Btn.this; }
        @Override public String getName() { return "rounded"; }
    };
    buttonColor = new ObjectPropertyBase<Color>(Color.WHITE) {
        @Override public Object getBean() { return Btn.this; }
        @Override public String getName() { return "buttonColor"; }
    };
    thumbColor  = new ObjectPropertyBase<Color>(Color.WHITE) {
        @Override public Object getBean() { return Btn.this; }
        @Override public String getName() { return "thumbColor"; }
    };
    textColor   = new ObjectPropertyBase<Color>(Color.WHITE) {
        @Override public Object getBean() { return Btn.this; }
        @Override public String getName() { return "textColor"; }
    };
    text        = new StringPropertyBase(TEXT) {
        @Override public Object getBean() { return Btn.this; }
        @Override public String getName() { return "textOn"; }
    };

    disabledProperty().addListener(o -> setOpacity(isDisabled() ? 0.4 : 1.0));
}
 
开发者ID:HanSolo,项目名称:MoodFX,代码行数:26,代码来源:Btn.java

示例2: Card

import javafx.beans.property.StringPropertyBase; //导入依赖的package包/类
public Card(final String TITLE) {
    getStylesheets().add(Card.class.getResource("card.css").toExternalForm());
    cardColor  = new StyleableObjectProperty<Color>(Color.web("#dae18f")) {
        @Override protected void invalidated() { container.setBackground(new Background(new BackgroundFill(get(), CornerRadii.EMPTY, Insets.EMPTY))); }
        @Override public Object getBean() { return Card.this; }
        @Override public String getName() { return "cardColor"; }
        @Override public CssMetaData<? extends Styleable, Color> getCssMetaData() { return CARD_COLOR; }
    };
    titleColor = new StyleableObjectProperty<Color>(Color.BLACK) {
        @Override protected void invalidated() { titleText.setTextFill(get()); }
        @Override public Object getBean() { return Card.this; }
        @Override public String getName() { return "titleColor"; }
        @Override public CssMetaData<? extends Styleable, Color> getCssMetaData() { return TITLE_COLOR; }
    };
    title      = new StringPropertyBase(TITLE) {
        @Override protected void invalidated() { titleText.setText(get()); }
        @Override public Object getBean() { return Card.this; }
        @Override public String getName() { return "title"; }
    };
    init();
    initGraphics();
    registerListeners();
}
 
开发者ID:HanSolo,项目名称:cardnav,代码行数:24,代码来源:Card.java

示例3: Switch

import javafx.beans.property.StringPropertyBase; //导入依赖的package包/类
public Switch() {
    getStyleClass().setAll("switch");
    rounded               = new BooleanPropertyBase(false) {
        @Override public Object getBean() { return Switch.this; }
        @Override public String getName() { return "rounded"; }
    };
    selected              = new BooleanPropertyBase(false) {
        @Override protected void invalidated() {
            if (null != getToggleGroup()) {
                if (get()) {
                    getToggleGroup().selectToggle(Switch.this);
                } else if (getToggleGroup().getSelectedToggle() == Switch.this) {
                    getToggleGroup().selectToggle(null);
                }
            }
            fireEvent(new SwitchEvent(Switch.this, null, selected.get() ? SwitchEvent.ON : SwitchEvent.OFF));
        }
        @Override public Object getBean() { return null; }
        @Override public String getName() { return null; }
    };
    toggleGroup           = new ObjectPropertyBase<ToggleGroup>(null) {
        private ToggleGroup oldToggleGroup;
        @Override protected void invalidated() {
            final ToggleGroup toggleGroup = get();
            if (null != toggleGroup && !toggleGroup.getToggles().contains(Switch.this)) {
                if (oldToggleGroup != null) { oldToggleGroup.getToggles().remove(Switch.this); }
                toggleGroup.getToggles().add(Switch.this);
            } else if (null == toggleGroup) {
                oldToggleGroup.getToggles().remove(Switch.this);
            }
            oldToggleGroup = toggleGroup;
        }
        @Override public Object getBean() { return Switch.this; }
        @Override public String getName() { return "toggleGroup"; }
    };
    switchColor           = new ObjectPropertyBase<Color>(Color.WHITE) {
        @Override public Object getBean() { return Switch.this; }
        @Override public String getName() { return "switchColor"; }
    };
    text                  = new StringPropertyBase("OFF") {
        @Override public Object getBean() { return Switch.this; }
        @Override public String getName() { return "text"; }
    };
    selectedText          = new StringPropertyBase("ON") {
        @Override public Object getBean() { return Switch.this; }
        @Override public String getName() { return "selectedText"; }
    };
    textColor             = new ObjectPropertyBase<Color>(Color.WHITE) {
        @Override public Object getBean() { return Switch.this; }
        @Override public String getName() { return "switchColorOff"; }
    };
    selectedTextColor     = new ObjectPropertyBase<Color>(Color.WHITE) {
        @Override public Object getBean() { return Switch.this; }
        @Override public String getName() { return "selectedTextColor"; }
    };
    handlerMap            = new ConcurrentHashMap<>(2);

    disabledProperty().addListener(o -> setOpacity(isDisabled() ? 0.4 : 1.0));
}
 
开发者ID:HanSolo,项目名称:MoodFX,代码行数:60,代码来源:Switch.java


注:本文中的javafx.beans.property.StringPropertyBase类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。