• (make-action spec)
Create an Action proxy from the given action spec. The standard keys
recognised are: :name, :accelerator, :command-key, :long-desc,
:short-desc, :mnemonic and :icon - corresponding to the similar named
Action properties. The :handler value is used in the actionPerformed
method of the proxy to pass on the event.

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/contrib/swing_utils.clj:80 top

(defn make-action
  "Create an Action proxy from the given action spec. The standard keys
  recognised are: :name, :accelerator, :command-key, :long-desc,
  :short-desc, :mnemonic and :icon - corresponding to the similar named
  Action properties.  The :handler value is used in the actionPerformed
  method of the proxy to pass on the event."
  [spec]
  (let [t-table @action-translation-table
        handler (:handler spec)
        spec    (dissoc spec :handler)
        spec    (map (fn [[k v]] [(t-table k) v]) spec)
        action  (proxy [AbstractAction] []
                  (actionPerformed [evt] (handler evt)))]
    (doseq [[k v] spec]
      (.putValue action k v))
    action))
Vars in clojure.contrib.swing-utils/make-action: defn doseq let
Used in 0 other vars

Comments top

No comments for make-action. Log in to add a comment.