Spinner.java 文件源码

java
阅读 27 收藏 0 点赞 0 评论 0

项目:mars-sim 作者:
/***************************************************************************
 *                                                                         *
 * Constructors                                                            *
 *                                                                         *
 **************************************************************************/

public Spinner() {
    getStyleClass().add(DEFAULT_STYLE_CLASS);

    getEditor().setOnAction(action -> {
        String text = getEditor().getText();
        SpinnerValueFactory<T> valueFactory = getValueFactory();
        if (valueFactory != null) {
            T value = valueFactory.fromString(text);
            valueFactory.setValue(value);
        }
    });

    getEditor().editableProperty().bind(editableProperty());

    value.addListener((o, oldValue, newValue) -> setText(newValue));

    // Fix for RT-29885
    getProperties().addListener((MapChangeListener<Object, Object>) change -> {
        if (change.wasAdded()) {
            if (change.getKey() == "FOCUSED") {
                setFocused((Boolean)change.getValueAdded());
                getProperties().remove("FOCUSED");
            }
        }
    });
    // End of fix for RT-29885
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号