Created
September 15, 2014 06:11
-
-
Save ebaxt/ffc1ae4de6980a9e0df8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks, lots to learn about Clojure ;)