   [fn]
   (SwingUtilities/invokeAndWait fn))
 
-(defmacro with-swing-threads
-  "Executes body with invoke-later to make it thread-safe to Swing."
-  [& body]
-  `(invoke-later #(do ~@body)))
-
 (defn get-resource
   "Returns the resource res if found, nil otherwise."
   [res]

  "Returns menubar of given frame."
  [frame]
  (get-component frame #(= (class %) JMenuBar)))

(declare hash-to-menu)


  "Adds the additional menus to the frame in front of the first Box.Filler
  found in the menu-bar of frame."
  [frame menus]
  (do-swing
   (let [menu-bar (get-menubar frame)
	 menu-bar-as-seq (.getComponents menu-bar)
	 menu-entries-before-filler (take-while #(not (instance? javax.swing.Box$Filler %))
						menu-bar-as-seq)
	 menu-entries-from-filler   (drop-while #(not (instance? javax.swing.Box$Filler %))
						menu-bar-as-seq)]
     (.removeAll menu-bar)
     (add-menus-to-menubar frame menu-entries-before-filler)
     (add-menus-to-menubar frame menus)
     (add-menus-to-menubar frame menu-entries-from-filler)
     (.validate frame))))

;;

(defvar --- {}
  "Separator for menu entries used in add-menus.")
