本文整理汇总了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));
}
示例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();
}
示例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));
}