It's a fork of seesaw. This fork has virtual dom feature like React.js does.
(ns seesaw.ex
(:require [seesaw.core :as s]
[seesaw.options :refer [satom get-k]]))
(def app-state (satom {:title "my-title"
:size [200 :by 325]}))
(def ff (s/frame :title (get-k app-state :title)
:size (get-k app-state :size)
:visible? true))
(swap! app-state update :title (constantly "helloo"))
;=>> re-renders the UI
(swap! app-state update :size (constantly [500 :by 300]))
;=>> re-renders the UI
Here's a brief tutorial that covers some Seesaw basics. It assumes no knowledge of Swing or Java.
Here's the slides from a Clojure/West 2012 talk on the Seesaw. Best viewed in Chrome or Safari.
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.
Seesaw is compatible with both Clojure 1.4, but will probably work fine with 1.3 and 1.5. Maybe even 1.2.
(listbox :model (range 100))
:background :blue
or :background "#00f"
, or :size [640 :by 480]
.There are numerous Seesaw examples in test/seesaw/test/examples.
Here's how you use Seesaw with Leiningen
Add Seesaw to project.clj
[ntestoc/seesaw "0.1.0"]
Replace the Seesaw version with whatever the latest version tag is. See below!
Now edit the generated src/hello_seesaw/core.clj
file:
(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:
lein install
to build it. Note that Seesaw uses Leiningen 2 as of 3 NOV 2012!project.clj
file, change the Seesaw version to X.Y.Z-SNAPSHOT
to match whatever's in Seesaw's project.clj
.lein deps
... actually you can just start coding. lein deps
is almost never necessary.Copyright (C) 2012 Dave Ray
Distributed under the Eclipse Public License, the same as Clojure.
Can you improve this documentation? These fine people already did:
Dave Ray, ertugrulcetin, Ertuğrul Çetin, chuchana, ntestoc3, Chun-wei Kuo, Teodor Heggelund, Artur Dryomov & Eric TurnerEdit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close