SimpleStringProperty set() vs. setValue()

后端 未结 2 1695
名媛妹妹
名媛妹妹 2021-02-07 04:01

What is the difference between set(String) and setValue(String) in the SimpleStringProperty class?

I know that set(String) is der

2条回答
  •  野的像风
    2021-02-07 04:39

    StringProperty.java :

    @Override
    public void setValue(String v) {
        set(v);
    }
    

    StringPropertyBase.java:

    @Override
    public void set(String newValue) {
        if (isBound()) {
            throw new java.lang.RuntimeException("A bound value cannot be set.");
        }
        if ((value == null)? newValue != null : !value.equals(newValue)) {
            value = newValue;
            markInvalid();
        }
    }
    

    In common case, you can open sources from open javafx and see that.

提交回复
热议问题