Last active
December 17, 2015 12:29
-
-
Save matstani/5610271 to your computer and use it in GitHub Desktop.
Clojure サンプルSwingアプリ+nREPLサーバ
This file contains 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 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!))) |
This file contains 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 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