(defmacro tree [& {[[old-path new-path] & code] :action n :name :as opts }]
(let [n (or n (gensym "tree"))]
`(scroll-panel
(let [~n (new JTree)]
(doto ~n
~@(if code
[`(add-listener .addTreeSelectionListener TreeSelectionListener
(valueChanged [e#]
(do-swing
(let [~new-path (if-let [p# (.getNewLeadSelectionPath e#)]
(path (.getLastPathComponent p#))
nil)
~old-path (if-let [p# (.getOldLeadSelectionPath e#)]
(path (.getLastPathComponent p#))
nil)]
~@code))))])
~@(auto-setters JTree *tree-known-keys* opts))))))
Used in 0 other vars
Comments top
No comments for tree. Log in to add a comment.