Skip to content

Instantly share code, notes, and snippets.

@rik0
Created June 5, 2011 09:40
Show Gist options
  • Save rik0/1008832 to your computer and use it in GitHub Desktop.
Save rik0/1008832 to your computer and use it in GitHub Desktop.
(ns gui-sample
(:import [javax.swing JFrame JButton]
[java.awt.event ActionListener]))
(defn build-gui [title message]
(let [frame (JFrame. title)
button (JButton. "CLICK")]
(.addActionListener button
(proxy [ActionListener] []
(actionPerformed [evt]
(println message))))
(.. frame getContentPane (add button))
(.pack frame)
(.setVisible frame true)
frame))
(ns gui-sample
(:import [javax.swing JFrame JButton]
[java.awt.event ActionListener]))
(defn build-gui [title message]
(let [frame (JFrame. title)
button (JButton. "CLICK")
px (proxy [ActionListener] []
(actionPerformed [evt]
(println message)))]
(.addActionListener button px)
(.. frame getContentPane (add button))
(.pack frame)
(.setVisible frame true)
px))
(update-proxy p {"actionPerformed" (fn [this evt] (println "foo!"))})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment