Skip to content

Instantly share code, notes, and snippets.

@matstani
Last active Dec 17, 2015
Embed
What would you like to do?
Clojure サンプルSwingアプリ+nREPLサーバ
(ns nrepl-test.core
(:require [seesaw.core :refer :all]
[clojure.tools.nrepl.server :refer [start-server]])
(:gen-class))
(defonce server (start-server :port 7888))
(def msg "Hello, Seesaw.")
(def lbl-msg
(label ""))
(defn set-msg!
[msg]
(config! lbl-msg :text msg))
(def btn-show-msg
(button :text "Show Message"))
(defn show-msg-actn
[e]
(set-msg! msg)
(-> e .getSource to-root pack!))
(def content (vertical-panel
:items [lbl-msg
btn-show-msg]))
(defn -main
[& args]
(invoke-later
(listen btn-show-msg
:action
#'show-msg-actn)
(-> (frame :title "Hello",
:content content,
:on-close :exit)
pack!
show!)))
(defproject nrepl-test "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.4.0"]
[seesaw "1.4.2"]
[org.clojure/tools.nrepl "0.2.3"]]
:main nrepl-test.core)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment