Hi Stephen,

uh? I didn't notice you put up a swing-utils in contrib.
I have a set of little macros + helper, which might also
be interesting:

(import 'javax.swing.SwingUtilities)

(defn do-swing*
  "Run the given thunk in the Swing event thread according to the given
  schedule.
    - :later => just schedule the execution and return
    - :now   => wait until the execution of the thunk completed."
  [schedule thunk]
  (cond
    (SwingUtilities/isEventDispatchThread) (thunk)
    (= schedule :later) (SwingUtilities/invokeLater thunk)
    (= schedule :now)   (SwingUtilities/invokeAndWait thunk)))

(defmacro do-swing
  "Execute the body in the Swing event thread. The execution might
  happend deferred."
  [& body]
  `(do-swing* :later (fn [] ~...@body)))

(defmacro do-swing-and-wait
  "Execute the body in the Swing event thread. The execution happens
  synchronised with the calling thread."
  [& body]
  `(do-swing* :now (fn [] ~...@body)))

I'm also working on some two little Action and Menu DSLs
to ease the programmatic generation of Menu, Toolbars,
etc. However this is not finished, yet. I'll post some code when
I'm done.

Sincerely
Meikel

PS: My CA is filed. Feel free to use the code for contrib.

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to