so, for a key listener, the keypressed method is called when you press
a key, right?
or am i misunderstanding how events work?

this is what i have:

(import
 '(javax.swing JFrame)
 '(java.awt  Canvas)
 '(java.awt.event KeyListener KeyEvent))

(def app (JFrame.))
(def canvas
     (proxy [Canvas KeyListener] []
       (KeyPressed [e] (print "hay! it's working!"))))

(doto canvas
  (setFocusable true)
  (addKeyListener canvas))

(doto app
  (add canvas)
  (setDefaultCloseOperation JFrame/EXIT_ON_CLOSE)
  (setSize 640 480)
  (setVisible true))


what i want it to do is print a message whenever a key is pressed, but
it doesn't.
(well, assuming that's how events are supposed to work.
the eventual plan is to have it so that when a key is pressed, it
calls a multimethod to deal with some refs. but it seems that i have
no idea what i'm doing here)

the window shows up, but key presses do nothing. (or nothing visible
in the frame or in the repl (slime), anyway)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to