-
- 参数类型
-
T- 包装值的类型
- All Superinterfaces:
-
Observable,ObservableValue<T>,ReadOnlyProperty<T>,WritableValue<T>
- All Known Subinterfaces:
-
JavaBeanProperty<T>
- 所有已知实现类:
-
BooleanProperty,BooleanPropertyBase,DoubleProperty,DoublePropertyBase,FloatProperty,FloatPropertyBase,IntegerProperty,IntegerPropertyBase,JavaBeanBooleanProperty,JavaBeanDoubleProperty,JavaBeanFloatProperty,JavaBeanIntegerProperty,JavaBeanLongProperty,JavaBeanObjectProperty,JavaBeanStringProperty,ListProperty,ListPropertyBase,LongProperty,LongPropertyBase,MapProperty,MapPropertyBase,ObjectProperty,ObjectPropertyBase,ReadOnlyBooleanWrapper,ReadOnlyDoubleWrapper,ReadOnlyFloatWrapper,ReadOnlyIntegerWrapper,ReadOnlyListWrapper,ReadOnlyLongWrapper,ReadOnlyMapWrapper,ReadOnlyObjectWrapper,ReadOnlySetWrapper,ReadOnlyStringWrapper,SetProperty,SetPropertyBase,SimpleBooleanProperty,SimpleDoubleProperty,SimpleFloatProperty,SimpleIntegerProperty,SimpleListProperty,SimpleLongProperty,SimpleMapProperty,SimpleObjectProperty,SimpleSetProperty,SimpleStringProperty,SimpleStyleableBooleanProperty,SimpleStyleableDoubleProperty,SimpleStyleableFloatProperty,SimpleStyleableIntegerProperty,SimpleStyleableLongProperty,SimpleStyleableObjectProperty,SimpleStyleableStringProperty,StringProperty,StringPropertyBase,StyleableBooleanProperty,StyleableDoublePropertyStyleableDoubleProperty,StyleableFloatProperty,StyleableIntegerProperty,StyleableLongProperty,StyleableObjectProperty,StyleableStringProperty
public interface Property<T> extends ReadOnlyProperty<T>, WritableValue<T>
通用接口,定义所有(可写)属性共有的方法,与其类型无关。- 从以下版本开始:
- JavaFX 2.0
-
-
方法摘要
所有方法 接口方法 抽象方法 Modifier and Type 方法 描述 voidbind(ObservableValue<? extends T> observable)为此创建一个单向绑定Property。voidbindBidirectional(Property<T> other)在这个Property和另一个之间创建双向绑定。booleanisBound()可以用来检查,如果一个Property是绑定的。voidunbind()删除此Property的单向绑定。voidunbindBidirectional(Property<T> other)删除此Property和另一个之间的双向绑定。-
Methods inherited from interface javafx.beans.Observable
addListener, removeListener
-
Methods inherited from interface javafx.beans.value.ObservableValue
addListener, getValue, removeListener
-
Methods inherited from interface javafx.beans.property.ReadOnlyProperty
getBean, getName
-
Methods inherited from interface javafx.beans.value.WritableValue
getValue, setValue
-
-
-
-
方法详细信息
-
bind
void bind(ObservableValue<? extends T> observable)
为此创建一个单向绑定Property。请注意,JavaFX具有通过弱侦听器实现的所有绑定调用。 这意味着bound属性可以被垃圾回收并停止更新。
- 参数
-
observable- 可观察这Property应该绑定。 - 异常
-
NullPointerException- 如果observable是null
-
unbind
void unbind()
删除此Property的单向绑定。 如果Property未绑定,则调用此方法没有任何作用。
-
isBound
boolean isBound()
可以用来检查,如果一个Property是绑定的。- 结果
-
true如果Property是绑定的,false否则 - 另请参见:
-
bind(javafx.beans.value.ObservableValue)
-
bindBidirectional
void bindBidirectional(Property<T> other)
在这个Property和另一个之间创建双向绑定。 双向绑定与单向绑定无关。 因此,可以向具有双向绑定的属性添加单向绑定,反之亦然。 但是,这种做法是不鼓励的。可以有一个属性的多个双向绑定。
JavaFX双向绑定实现使用弱侦听器。 这意味着双向绑定不会阻止属性被垃圾回收。
- 参数
-
other- 其他Property - 异常
-
NullPointerException- 如果other是null -
IllegalArgumentException- 如果other是this
-
unbindBidirectional
void unbindBidirectional(Property<T> other)
删除此Property和另一个之间的双向绑定。 如果不存在属性之间的双向绑定,则调用此方法不起作用。 可以通过第二个属性的调用解除绑定。 此代码将工作:property1.bindBirectional(property2); property2.unbindBidirectional(property1);- 参数
-
other- 其他Property - 异常
-
NullPointerException- 如果other是null -
IllegalArgumentException- 如果other是this
-
-