Created
June 5, 2011 09:40
-
-
Save rik0/1008832 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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)) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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