code of the delegate class (this channel is rather...
# javafx
h
code of the delegate class (this channel is rather quiet, so I'll post the code directly):
Copy code
import javafx.beans.property.Property
import kotlin.reflect.KProperty

class PropertyDelegate<T>(val javafxProperty: Property<T>) {
    operator fun getValue(thisRef: Any?,
                          property: KProperty<*>): T {
        return javafxProperty.value
    }

    operator fun setValue(thisRef: Any?,
                          property: KProperty<*>,
                          value: T) {
        javafxProperty.value = value
    }
}

fun <T> property(javafxProperty: Property<T>) = PropertyDelegate(javafxProperty)