onFocus

fun SwingModifier.onFocus(onGained: () -> Unit = UNDECLARED_ACTION, onLost: () -> Unit = UNDECLARED_ACTION): SwingModifier

Installs focus gained/lost handlers.

A callback left undeclared reports nowhere, and declaring neither is refused.

Return

this chain with the focus handlers declared on it.

Parameters

onGained

runs when the component becomes the focus owner, its window regaining activation included.

onLost

runs when it stops being the focus owner, the temporary loss while another window is active included.

See also