I created a java frame with seesaw
(def f (frame :title "my app"))
and I would like to catch user keypress.
I tried to gather code here and there and ended with this
(ns myapp.core
(:use seesaw.core)
(:use seesaw.font)
(:import [java.awt.event ActionListener KeyListener KeyEvent])
)
(defn input-listener []
(proxy [ActionListener KeyListener] []
(actionPerformed [e])
(keyPressed [e] (alert e "You pressed a key!"))
(keyReleased [e])
(keyTyped [e])))
(doto f
(.addKeyListener (input-listener)))
but it won't work at all. I am new to clojure and since I absolutely don't know anything JAVA (and don't really want to ding into it) I am a bit lost. Is there a simple way to catch user input for keyboard shortcuts in the whole app ?
help please.