Note that current development is on the develop branch, not master
There's now a Google Group for discussion and questions.
Here's a brief tutorial that covers some Seesaw basics. It assumes no knowledge of Swing or Java.
Seesaw: Clojure + UI
See the Seesaw Wiki and the Seesaw API Docs for more detailed docs. Note that the docs in the code (use the
doc function!) are always the most up-to-date and trustworthy.
Seesaw is a library/DSL for constructing user interfaces in Clojure. It happens to be built on Swing, but please don't hold that against it. It's an experiment to see what I can do to make user interface development funner in Clojure. It's kinda inspired by Shoes, Stuart Sierra's Swing posts, etc. clojure.contrib.swing-utils is useful, but minimal and still means a lot of "Java-in-Clojure" coding.
Seesaw is compatible with both Clojure 1.2 and 1.3.
- Construct widgets with simple functions, e.g.
(listbox :model (range 100))
- Support for all of Swing's built-in widgets as well as SwingX.
- Support for all of Swing's layout managers as well as MigLayout, and JGoodies Forms
- Convenient shortcuts for most properties. For example,
:background "#00f", or
:size [640 :by 480].
- CSS-style selectors with same syntax as Enlive.
- Unified, extensible event API
- Unified, extensible selection API
- Widget binding, i.e. map changes from one widget into one or more others in a more functional style. Also integrates with Clojure's reference types.
- An extensive test suite
There are numerous Seesaw examples in test/seesaw/test/examples.
Here's how you use Seesaw with Leiningen
lein as described and then:
$ lein new hello-seesaw $ cd hello-seesaw
Add Seesaw to
(defproject hello-seesaw "1.0.0-SNAPSHOT" :description "FIXME: write" :dependencies [[org.clojure/clojure "1.3.0"] [seesaw "x.y.z"]])
Replace the Seesaw version with whatever the latest version tag is. See below!
Now edit the generated
(ns hello-seesaw.core (:use seesaw.core)) (defn -main [& args] (invoke-later (-> (frame :title "Hello", :content "Hello, Seesaw", :on-close :exit) pack! show!)))
Now run it:
$ lein run -m hello-seesaw.core
NOTE: Here's how you can run against the bleeding edge of Seesaw:
- Clone Seesaw from github. Fork if you like. Switch to the "develop" branch.
- In your Seesaw checkout, run
lein installto build it
- In your project's
project.cljfile, change the Seesaw version to
X.Y.Z-SNAPSHOTto match whatever's in Seesaw's
- Move along
- Meikel Brandmeyer (kotarak)
- David Brunell (Quantalume)
- Stuart Campbell (harto)
- Michael Frericks
- Jonathan Fischer Friberg (odyssomay)
- Anthony Grimes (Raynes)
- Thomas Karolski (MHOOO)
- Chun-wei Kuo (Domon)
- Vladimir Matveev (dpx-infinity)
Copyright (C) 2011 Dave Ray
Distributed under the Eclipse Public License, the same as Clojure.