Module javafx.base

Interface Property<T>

    • Method Detail

      • bind

        void bind​(ObservableValue<? extends T> observable)
        Create a unidirection binding for this Property.

        Note that JavaFX has all the bind calls implemented through weak listeners. This means the bound property can be garbage collected and stopped from being updated.

        Parameters:
        observable - The observable this Property should be bound to.
        Throws:
        NullPointerException - if observable is null
      • bindBidirectional

        void bindBidirectional​(Property<T> other)
        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.

        Parameters:
        other - the other Property
        Throws:
        NullPointerException - if other is null
        IllegalArgumentException - if other is this
      • unbindBidirectional

        void unbindBidirectional​(Property<T> 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. It is possible to unbind by a call on the second property. This code will work:
             property1.bindBirectional(property2);
             property2.unbindBidirectional(property1);
         
        Parameters:
        other - the other Property
        Throws:
        NullPointerException - if other is null
        IllegalArgumentException - if other is this