treeSelectionListener
fun SwingModifier.treeSelectionListener(onSelectionChange: (TreeSelectionEvent) -> Unit): SwingModifier
Runs onSelectionChange whenever the tree's selection changes. Requires a javax.swing.JTree 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 paths were added to or removed from the selection and whose isAddedPath says which of the two happened to a given path.
See also
Attaches a TreeSelectionListener (addTreeSelectionListener/removeTreeSelectionListener). Requires a javax.swing.JTree 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.