Skip to content

Instantly share code, notes, and snippets.

@dakrone
Created June 11, 2010 22:45
Show Gist options
  • Select an option

  • Save dakrone/435156 to your computer and use it in GitHub Desktop.

Select an option

Save dakrone/435156 to your computer and use it in GitHub Desktop.
(defn make-repl-jframe
"Displays a JFrame with JConsole and attached REPL."
([] (make-repl-jframe {}))
([optmap]
(let [jframe (make-jframe (merge default-opts optmap))]
(javax.swing.SwingUtilities/invokeAndWait
#(let [console (bsh.util.JConsole.)]
(doto (.getContentPane jframe)
(.setLayout (java.awt.BorderLayout.))
(.add console))
(.pack jframe)
(binding [*out* (java.io.OutputStreamWriter. (.getOut console))
*in* (clojure.lang.LineNumberingPushbackReader. (.getIn console))]
(.start (Thread. (bound-fn [] (clojure.main/repl))))))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment