API for swing-utils
Full namespace name: clojure.contrib.swing-utils
Public Variables and Functions
Translation table for the make-action constructor.
Usage: (add-action-listener component f & args)
Adds an ActionLister to component. When the action fires, f will be
invoked with the event as its first argument followed by args.
Returns the listener.
Usage: (add-key-typed-listener component f & args)
Adds a KeyListener to component that only responds to KeyTyped events.
When a key is typed, f is invoked with the KeyEvent as its first argument
followed by args. Returns the listener.
Usage: (add-menu-item parent item)
Adds a menu item to the parent according to the item description.
The item description is a map of the following structure.
- one single :action specifying a javax.swing.Action to be associated
with the item.
- a specification suitable for make-action
- a set of :name, :mnemonic and :items keys, specifying a submenu with
the given sequence of item entries.
- an empty map specifying a separator.
Usage: (do-swing & body)
Executes body in the Swing event thread asynchronously. Returns
immediately after scheduling the execution.
Usage: (do-swing* schedule thunk)
Runs thunk in the Swing event thread according to schedule:
- :later => schedule the execution and return immediately
- :now => wait until the execution completes.
Usage: (do-swing-and-wait & body)
Executes body in the Swing event thread synchronously. Returns
after the execution is complete.
Usage: (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.
Usage: (make-menubar menubar-items)
Create a menubar containing the given sequence of menu items. The menu
items are described by a map as is detailed in the docstring of the
An atom containing the dispatch set for the add-menu-item method.