public abstract class DoubleProperty extends ReadOnlyDoubleProperty implements Property<Number>, WritableDoubleValue
double値をラップするPropertyを定義します。
ObservableDoubleValue.get()、DoubleExpression.getValue()、WritableDoubleValue.set(double)およびsetValue(Number)を使用して、DoublePropertyの値を取得および設定できます。
Property.bind(ObservableValue)およびProperty.unbind()を使用して、プロパティを一方向にバインドおよびバインド解除できます。 bindBidirectional(Property)およびunbindBidirectional(Property)を使用して、双方向バインディングを作成および削除できます。
ReadOnlyProperty.getBean()およびReadOnlyProperty.getName()を使用して、DoublePropertyのコンテキストを読み取ることができます。
ノート: null値へのこのプロパティの設定またはバインドにより、プロパティが0.0に設定されます。 setValue(java.lang.Number)を参照してください。
ObservableDoubleValue、WritableDoubleValue、ReadOnlyDoubleProperty、Property| コンストラクタと説明 |
|---|
DoubleProperty() |
| 修飾子と型 | メソッドと説明 |
|---|---|
ObjectProperty<Double> |
asObject()
この
DoublePropertyに双方向にバインドされたObjectPropertyを作成します。 |
void |
bindBidirectional(Property<Number> other)
この
Propertyと別のPropertyの間の双方向バインディングを作成します。 |
static DoubleProperty |
doubleProperty(Property<Double> property)
Propertyをラップし、双方向にバインドされるDoublePropertyを返します。 |
void |
setValue(Number v)
ラップされた値を設定します。
|
String |
toString()
この
DoublePropertyオブジェクトの文字列表現を返します。 |
void |
unbindBidirectional(Property<Number> other)
この
Propertyと別のPropertyの間の双方向バインディングを削除します。 |
readOnlyDoublePropertyadd, add, add, add, add, divide, divide, divide, divide, divide, doubleExpression, doubleExpression, doubleValue, floatValue, getValue, intValue, longValue, multiply, multiply, multiply, multiply, multiply, negate, subtract, subtract, subtract, subtract, subtractasString, asString, asString, greaterThan, greaterThan, greaterThan, greaterThan, greaterThan, greaterThanOrEqualTo, greaterThanOrEqualTo, greaterThanOrEqualTo, greaterThanOrEqualTo, greaterThanOrEqualTo, isEqualTo, isEqualTo, isEqualTo, isEqualTo, isEqualTo, isEqualTo, isEqualTo, isEqualTo, isNotEqualTo, isNotEqualTo, isNotEqualTo, isNotEqualTo, isNotEqualTo, isNotEqualTo, isNotEqualTo, isNotEqualTo, lessThan, lessThan, lessThan, lessThan, lessThan, lessThanOrEqualTo, lessThanOrEqualTo, lessThanOrEqualTo, lessThanOrEqualTo, lessThanOrEqualTo, numberExpressionclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetBean, getNameaddListener, getValue, removeListeneraddListener, removeListenerget, setgetValuegetpublic void setValue(Number v)
WritableDoubleValueのsetValueWritableValue<Number>のsetValuev - 新しい値public void bindBidirectional(Property<Number> other)
Propertyと別のPropertyの間の双方向バインディングを作成します。 双方向バインディングは、一方向バインディングと独立して存在します。 そのため、一方向バインディングを双方向バインディングを使用したプロパティに追加でき、その逆も可能です。 ただし、このプラクティスは推奨されていません。
1つのPropertyに複数の双方向バインディングを使用できます。
JavaFX双方向バインディング実装は、弱いリスナーを使用します。 これは、双方向バインディングによってプロパティがガベージ・コレクションされないことを意味します。
Property<Number>のbindBidirectionalother - 他のPropertypublic void unbindBidirectional(Property<Number> other)
Propertyと別のPropertyの間の双方向バインディングを削除します。 プロパティ間の双方向バインディングが存在しない場合、このメソッドの呼出しは影響しません。 2つ目のプロパティの呼出しによって、バインド解除できます。 このコードが動作します:
property1.bindBirectional(property2);
property2.unbindBidirectional(property1);
Property<Number>のunbindBidirectionalother - 他のPropertypublic String toString()
DoublePropertyオブジェクトの文字列表現を返します。ReadOnlyDoublePropertyのtoStringDoublePropertyオブジェクトの文字列表現。public static DoubleProperty doubleProperty(Property<Double> property)
Propertyをラップし、双方向にバインドされるDoublePropertyを返します。 このプロパティの変更により、元のプロパティが変更されます。
ObjectProperty
別の方法は、DoubleProperty doubleProperty = new SimpleDoubleProperty(1.0); ObjectProperty<Double> objectProperty = new SimpleObjectProperty<>(2.0); // Need to keep the reference as bidirectional binding uses weak references DoubleProperty objectAsDouble = DoubleProperty.doubleProperty(objectProperty); doubleProperty.bindBidirectional(objectAsDouble);
asObject()メソッドを使用してDoublePropertyをObjectPropertyに変換することです。
ノート: ソース・プロパティのnull値は、0.0として解釈されます
property - ソースPropertyPropertyをラップするDoublePropertyNullPointerException - propertyがnullの場合asObject()public ObjectProperty<Double> asObject()
DoublePropertyに双方向にバインドされたObjectPropertyを作成します。 このDoublePropertyの値が変更されると、ObjectPropertyの値が自動的に更新され、その逆も同様です。
DoublePropertyへのObjectPropertyのバインドに使用できます。
DoubleProperty doubleProperty = new SimpleDoubleProperty(1.0); ObjectProperty<Double> objectProperty = new SimpleObjectProperty<>(2.0); objectProperty.bind(doubleProperty.asObject());
ReadOnlyDoublePropertyのasObjectObjectPropertyCopyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.