Adds a KeyListener to component that only responds to KeyTyped events.
When a key is typed, f is invoked with the KeyEvent as its first argument
followed by args. Returns the listener.
(defn add-key-typed-listener
"Adds a KeyListener to component that only responds to KeyTyped events.
When a key is typed, f is invoked with the KeyEvent as its first argument
followed by args. Returns the listener."
[component f & args]
(let [listener (proxy [KeyAdapter] []
(keyTyped [event] (apply f event args)))]
(.addKeyListener component listener)
listener))
Comments top
No comments for add-key-typed-listener. Log in to add a comment.