Skip to content

Instantly share code, notes, and snippets.

@matstani
Last active December 17, 2015 12:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matstani/5610271 to your computer and use it in GitHub Desktop.
Save matstani/5610271 to your computer and use it in GitHub Desktop.
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