changeListener

Runs onChange on the change event of a component that fires one - the widgets changeListener lists.

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

Return

this chain with the change callback declared on it.

Parameters

onChange

receives the event, which carries nothing but its source: read the new state off the component itself.

See also


inline fun <T : Component> SwingModifier.changeListener(noinline onChange: T.(ChangeEvent) -> Unit): SwingModifier

Runs onChange on the change event of a component of type T that fires one, with that component as this.

Return

this chain with the change callback declared on it.

Parameters

onChange

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


Runs onChange on the change event of a component of type targetType that fires one, with that component as this. An event sourced anywhere else is refused; see listener.

A JColorChooser publishes through its selection model, so its change events name that model rather than the chooser and are not ones this overload can scope.

Return

this chain with the change callback declared on it.

Parameters

targetType

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

onChange

read when the event fires.

See also


Attaches a ChangeListener (addChangeListener/removeChangeListener) to a component that fires change events (JSlider, JSpinner, JTabbedPane, JProgressBar, AbstractButton, JViewport, JColorChooser). A color chooser publishes its change events through its selectionModel, and the registration follows that model when the chooser is given another one.

Return

this chain with the 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