propertyChangeListener

Runs onPropertyChange on every bound property change of the component. For a single property, prefer the name overload.

onPropertyChange is read when the event fires, so writing a fresh lambda on every recomposition registers nothing again.

Return

this chain with the property change callback declared on it.

Parameters

onPropertyChange

receives the event, whose propertyName, oldValue and newValue describe the change; a component fires nothing where the two values are both non-null and equal.

See also


Runs onPropertyChange on changes to the property name only.

onPropertyChange is read when the event fires, so writing a fresh lambda on every recomposition registers nothing again. Declaring a different name moves the registration to that property.

Return

this chain with the property change callback declared on it.

Parameters

name

the bound property, spelled as the component fires it; a name nothing fires reports nothing and is not an error.

onPropertyChange

receives that property's events, with oldValue and newValue as the component reported them.

See also


inline fun <T : Component> SwingModifier.propertyChangeListener(name: String, noinline onPropertyChange: T.(PropertyChangeEvent) -> Unit): SwingModifier

Runs onPropertyChange on changes to the property name of a component of type T, with that component as this.

Return

this chain with the property change callback declared on it.

Parameters

name

the bound property, spelled as the component fires it.

onPropertyChange

read when the event fires. A parameter of the enclosing composable shadows the receiver, so reach it through this. Read the component's state through the receiver; writing a property the composition declares through it makes the second manager listener describes.

See also


fun <T : Component> SwingModifier.propertyChangeListener(name: String, targetType: KClass<T>, onPropertyChange: T.(PropertyChangeEvent) -> Unit): SwingModifier

Runs onPropertyChange on changes to the property name of a component of type targetType, with that component as this. An event sourced anywhere else is refused; see listener.

Return

this chain with the property change callback declared on it.

Parameters

name

the bound property, spelled as the component fires it.

targetType

the component type the node and every event's source are both checked against.

onPropertyChange

read when the event fires.

See also


Attaches an unbound PropertyChangeListener (addPropertyChangeListener), notified of every bound property change. For a single property, prefer the name overload.

Return

this chain with the property change listener declared on it.

Parameters

listener

attached by identity, so a remembered instance stays put while a fresh one on every pass is detached and re-added.

See also


Attaches a PropertyChangeListener bound to the property name (addPropertyChangeListener(name, listener)), notified only of changes to that property.

Return

this chain with the bound property listener declared on it.

Parameters

name

the bound property, spelled as the component fires it.

listener

attached by identity, so a remembered instance stays put while a fresh one on every pass is detached and re-added.

See also