Skip to content

Instantly share code, notes, and snippets.

@tgk
Created Oct 8, 2012
Embed
What would you like to do?
A Swing example in Clojure
(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