How to build desktop applications with Clojure and Swing

(written by lawrence krubner, however indented passages are often quotes). You can contact lawrence at:

This makes me hopeful. More to the point, it makes me want to work on desktop apps with Clojure.

Starting a Clojure Desktop Application
We’re starting up our first desktop application in Clojure. We’re a heavy vim and ruby shop. We’ve done several desktop applications in JRuby. This is the first time we’ve tackled swing UIs and GUI testing in Clojure. It’s still early in the process, but here’s what we’ve found so far.

For Swing, we’re using seesaw. It provides Clojure bindings to standard Swing widgets and MigLayout, which was all I set out looking for. What really impressed me, however, was its CSS selector engine, allowing you to query a frame for particular widgets for event subscription or manipulation. It also offers an impressive data binding mechanism similar to UNIX pipes, complete with transformations and tee.

We’re using Brian Marick’s Midje for unit testing and fest to automate system tests.

Leiningen manages our dependencies and packages our jars. We’ve found it helpful to set up a local maven repository in our vendor directory for a couple of cases where we needed a jar that was neither in the main maven repository nor clojars.

We’re heavy Vim users here at AO, but as fantastic as VimClojure is, paredit.vim from slimv just doesn’t compare to Emacs’ glorious mode. I’m pretty incompetent in Emacs, but the Emacs starter kit and a weekend of practice with Emacs and ParEdit has taken the shine off my beloved vim for lisp editing. (It’s actually been a while since I last used Emacs, so I’m sticking with vim in the short term while I ramp back up with Emacs).