title: Clojure: exit program when Window Frame is Closed
body: <p>I'd like my Clojure program to exit when a JFrame is closed. </p>
  
  <p>I'm attempting to trap and handle the close event as such:</p>
  
  <pre><code>(def exit-action (proxy [WindowAdapter] []
                 (windowClosing [event] (fn [] (System/exit 0)))
                 )
  )
  (.addWindowListener frame exit-action)
  </code></pre>
  
  <p>This doesn't throw any obvious errors but it also doesn't appear to do what I want.</p>
  
  <p>Assistance is appreciated. </p>
  
  <p>Answer:</p>
  
  <p>Adapting Rekin's answer did the trick:</p>
  
  <pre><code>(.setDefaultCloseOperation frame JFrame/EXIT_ON_CLOSE)
  </code></pre>
  
  <p>Note that that is:</p>
  
  <pre><code>setDefaultCloseOperation 
  </code></pre>
  
  <p>not:</p>
  
  <pre><code>setDefaultOperationOnClose
  </code></pre>