You can use add-watch to add a callback that will be called every time ref is changed. This callback should call a method that updates the list:
(def data (ref [1 2 3])) (defn list-model "Create list model based on collection" [items] (let [model (javax.swing.DefaultListModel.)] (doseq [item items] (.addElement model item)) model)) (def listbox (seesaw.core/listbox :model [])) (add-watch data nil (fn [_ _ _ items] (.setModel listbox (list-model items))))
source share