I created a java frame with a swing
(def f (frame :title "my app"))
and I would like to catch a user click.
I tried to compile the code here and there and ended up 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 that will not work. I am new to clojure, and since I know absolutely nothing about JAVA (and really don't want to enter it), I got a little lost. Is there an easy way to catch user input for keyboard shortcuts throughout the application?
help me please.
source share