listSelectionListener

Runs onSelectionChange whenever the list's selection changes. Requires a JList target.

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

Return

this chain with the selection callback declared on it.

Parameters

onSelectionChange

receives the event, whose firstIndex and lastIndex are the ends of the row range to re-read, and whose valueIsAdjusting is true while the user is still dragging the selection out - a handler that wants only the settled result skips those.

See also


inline fun <T : JList<*>> SwingModifier.listSelectionListener(noinline onSelectionChange: T.(ListSelectionEvent) -> Unit): SwingModifier

Runs onSelectionChange on the selection event of a list of type T, with that list as this.

Return

this chain with the selection callback declared on it.

Parameters

onSelectionChange

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 : JList<*>> SwingModifier.listSelectionListener(targetType: KClass<T>, onSelectionChange: T.(ListSelectionEvent) -> Unit): SwingModifier

Runs onSelectionChange on the selection event of a list of type targetType, with that list as this. An event sourced anywhere else is refused; see listener.

Return

this chain with the selection callback declared on it.

Parameters

targetType

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

onSelectionChange

read when the event fires.

See also


Attaches a ListSelectionListener (addListSelectionListener/removeListSelectionListener). Requires a JList target.

Return

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