Skip to content

Instantly share code, notes, and snippets.

@ebaxt
Created September 15, 2014 06:11
Show Gist options
  • Save ebaxt/ffc1ae4de6980a9e0df8 to your computer and use it in GitHub Desktop.
Save ebaxt/ffc1ae4de6980a9e0df8 to your computer and use it in GitHub Desktop.
(ns ui.core
(:require [seesaw.core :as c]
[seesaw.border :as b])
(:gen-class :main true))
(defn send-msg [event]
(let [val (-> event
(c/to-frame)
(c/select [:#msg-txt])
(c/value))]
(c/alert event
(str "<html>Hello from <b>Clojure</b>. Button " val))))
(defn create-frame []
(-> (c/frame :title "Chat",
:on-close :exit,
:content (c/vertical-panel
:items [(c/label :text "Write a message")
(c/text :id :msg-txt :columns 20 :border [5 (b/line-border)])
(c/button :text "Send" :listen [:action send-msg])]))))
(defn run-it []
(-> (create-frame)
(c/pack!)
(c/show!)))
(defn -main []
(run-it))
(defproject ui "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.6.0"]
[seesaw "1.4.4"]]
:main ui.core)
@reidarsollid
Copy link

Thanks, lots to learn about Clojure ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment