keyListener
Runs onKeyEvent for every key event on the component - a press, a release and the character they type alike, so one keystroke reports more than once. Declare the events one by one to tell them apart.
onKeyEvent is read when the event fires, so writing a fresh lambda on every recomposition registers nothing again.
Return
this chain with the key callback declared on it.
Parameters
receives the event, which reports only while the component holds the keyboard focus.
See also
Runs each lambda on the key event it is declared for. An event left undeclared reports nowhere.
Each lambda is read when its event fires, so writing a fresh one on every recomposition registers nothing again.
Declaring none at all is refused.
Return
this chain with the key callbacks declared on it.
Parameters
runs for the character a keystroke produces, carrying a keyChar and VK_UNDEFINED for its keyCode; a key that produces no Unicode character, such as an arrow, never reaches it.
runs when the key goes down; whether holding it repeats, and in what order the events then arrive, the platform decides.
runs when the key comes back up.
See also
Attaches a KeyListener (addKeyListener/removeKeyListener).
Return
this chain with the key listener declared on it.
Parameters
attached by identity, so a remembered instance stays put while a fresh one on every pass is detached and re-added.