Created
October 8, 2012 17:09
-
-
Save tgk/3853658 to your computer and use it in GitHub Desktop.
A Swing example in Clojure
This file contains hidden or 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 swing | |
(:import [javax.swing JFrame JLabel JButton] | |
[java.awt.event WindowListener])) | |
(defn swing [] | |
(let [frame (JFrame. "Fund manager") | |
label (JLabel. "Exit on close")] | |
(doto frame | |
(.add label) | |
(.setDefaultCloseOperation JFrame/EXIT_ON_CLOSE) | |
(.addWindowListener | |
(proxy [WindowListener] [] | |
(windowClosing [evt] | |
(println "Whoop")))) | |
(.setVisible true)))) | |
(defn -main [& args] | |
(swing)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment