APIdia Launch Partner
Top Description Constructors Methods
javafx.beans.property

public abstract Class StringProperty

extends ReadOnlyStringProperty
implements Property<String>, WritableStringValue
Class Inheritance
All Implemented Interfaces
javafx.beans.value.WritableStringValue, javafx.beans.value.WritableObjectValue, javafx.beans.value.WritableValue, javafx.beans.property.Property, javafx.beans.property.ReadOnlyProperty, javafx.beans.value.ObservableValue, javafx.beans.Observable
Known Direct Subclasses
javafx.beans.property.StringPropertyBase, javafx.beans.property.adapter.JavaBeanStringProperty
Imports
javafx.beans.binding.Bindings, javafx.beans.value.ObservableValue, .WritableStringValue, javafx.util.StringConverter, java.text.Format

This class provides a full implementation of a Property wrapping a String value. The value of a StringProperty can be get and set with get(), getValue(), set(Object), and setValue(String). A property can be bound and unbound unidirectional with bind(ObservableValue) and unbind(). Bidirectional bindings can be created and removed with bindBidirectional(Property) and unbindBidirectional(Property). The context of a StringProperty can be read with getBean() and getName().
Since
JavaFX 2.0
See Also
javafx.beans.value.ObservableStringValue, javafx.beans.value.WritableStringValue, ReadOnlyStringProperty, Property

Constructor Summary

AccessConstructor and Description
public
StringProperty()

Creates a default StringProperty.

Method Summary

Modifier and TypeMethod and Description
public void
bindBidirectional(Property<String> other)

Implements javafx.beans.property.Property.bindBidirectional.

Create a bidirectional binding between this Property and another one.

public void
bindBidirectional(Property<?>
the other Property
other
,
Format
the Format used to convert between this StringProperty and the other Property
format
)

Create a bidirectional binding between this StringProperty and another arbitrary property.

public <
the type of the wrapped Object
T
>
void
bindBidirectional(Property<T>
the other Property
other
,
StringConverter<T>
the StringConverter used to convert between this StringProperty and the other Property
converter
)

Create a bidirectional binding between this StringProperty and another arbitrary property.

public void
setValue(String v)

Implements javafx.beans.value.WritableValue.setValue.

Set the wrapped value.

public String

Returns:

a string representation of this StringProperty object.
toString
()

Overrides javafx.beans.property.ReadOnlyStringProperty.toString.

Returns a string representation of this StringProperty object.

public void
unbindBidirectional(Property<String> other)

Implements javafx.beans.property.Property.unbindBidirectional.

Removes a bidirectional binding between this Property and another one.

public void
unbindBidirectional(Object
the other Property
other
)

Remove a bidirectional binding between this Property and another one.

Constructor Detail

StringPropertyback to summary
public StringProperty()

Creates a default StringProperty.

Method Detail

bindBidirectionalback to summary
public void bindBidirectional(Property<String> other)

Implements javafx.beans.property.Property.bindBidirectional.

Doc from javafx.beans.property.Property.bindBidirectional.

Create a bidirectional binding between this Property and another one. Bidirectional bindings exists independently of unidirectional bindings. So it is possible to add unidirectional binding to a property with bidirectional binding and vice-versa. However, this practice is discouraged.

It is possible to have multiple bidirectional bindings of one Property.

JavaFX bidirectional binding implementation use weak listeners. This means bidirectional binding does not prevent properties from being garbage collected.

Annotations
@Override
bindBidirectionalback to summary
public void bindBidirectional(Property<?> other, Format format)

Create a bidirectional binding between this StringProperty and another arbitrary property. Relies on an implementation of Format for conversion.

Parameters
other:Property<?>

the other Property

format:Format

the Format used to convert between this StringProperty and the other Property

Exceptions
NullPointerException:
if other or format is null
IllegalArgumentException:
if other is this
Since
JavaFX 2.1
bindBidirectionalback to summary
public <T> void bindBidirectional(Property<T> other, StringConverter<T> converter)

Create a bidirectional binding between this StringProperty and another arbitrary property. Relies on an implementation of StringConverter for conversion.

Parameters
<T>
the type of the wrapped Object
other:Property<T>

the other Property

converter:StringConverter<T>

the StringConverter used to convert between this StringProperty and the other Property

Exceptions
NullPointerException:
if other or converter is null
IllegalArgumentException:
if other is this
Since
JavaFX 2.1
setValueback to summary
public void setValue(String v)

Implements javafx.beans.value.WritableValue.setValue.

Doc from javafx.beans.value.WritableValue.setValue.

Set the wrapped value.

Annotations
@Override
toStringback to summary
public String toString()

Overrides javafx.beans.property.ReadOnlyStringProperty.toString.

Returns a string representation of this StringProperty object.

Returns:String

a string representation of this StringProperty object.

Annotations
@Override
unbindBidirectionalback to summary
public void unbindBidirectional(Property<String> other)

Implements javafx.beans.property.Property.unbindBidirectional.

Doc from javafx.beans.property.Property.unbindBidirectional.

Removes a bidirectional binding between this Property and another one. If no bidirectional binding between the properties exists, calling this method has no effect. It is possible to unbind by a call on the second property. This code will work:

    property1.bindBidirectional(property2);
    property2.unbindBidirectional(property1);
Annotations
@Override
unbindBidirectionalback to summary
public void unbindBidirectional(Object other)

Remove a bidirectional binding between this Property and another one. If no bidirectional binding between the properties exists, calling this method has no effect.

Parameters
other:Object

the other Property

Exceptions
NullPointerException:
if other is null
IllegalArgumentException:
if other is this
Since
JavaFX 2.1