【发布时间】:2011-08-22 22:41:46
【问题描述】:
我这里有一小段代码。
(ns experiments
(:import (javax.swing JFrame JLabel)))
(defn create-frame [title text]
(doto (JFrame. title)
(.add (JLabel. text))
(.pack)
(.setDefaultCloseOperation JFrame/EXIT_ON_CLOSE)
(.setVisible true)))
现在我运行一个 REPL(Clojure Box,基本上是 emacs + slime),从正确的类路径开始,等等,调用(使用'experiments)——这有效——然后调用
(create-frame "Foo" "Bar").
然后……什么都没有。 REPL 永远挂断,没有帧出现,什么也没有。
【问题讨论】:
-
我刚刚注意到我输入错误:import as import。我的副本里有它。