A Swing example in Clojure
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 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