> What's happening in the ActionListener code?
Actually this is more a question of how does load-file work I believe.
If I run your example with (read) added to the end to prevent the main
thread ending from the command line:
clj test.clj
it works as expected... ie: ok gets printed when clicking.
However if I load your example at the REPL, I get your unexpected
behavior.
Additionally, without load-file in your example it works fine at the
REPL also:
(import '(javax.swing JButton JFrame)
'(java.awt.event ActionListener))
(def a (ref nil))
(let [frame (JFrame.)
button (JButton. "Click Me")]
(.addActionListener
button
(proxy [ActionListener] [] (actionPerformed [evt] (println @a))))
(doto frame
(.add button)
(.pack)
(.show)))
(dosync (ref-set a "hi mum"))
I'm stumped as to why load-file seems to behave differently from
command lane to REPL.
Regards,
Tim.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---