API for swing-utils
(1.1.x branch)
Usage:
(ns your-namespace
(:require clojure.contrib.swing-utils))
Overview
Public Variables and Functions
action-translation-table
var
Translation table for the make-action constructor.
Source
add-action-listener
function
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.
Source
add-key-typed-listener
function
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.
Source
multimethod
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.
Either:
- 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.
Source
do-swing
macro
Usage: (do-swing & body)
Executes body in the Swing event thread asynchronously. Returns
immediately after scheduling the execution.
Source
do-swing*
function
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.
Source
do-swing-and-wait
macro
Usage: (do-swing-and-wait & body)
Executes body in the Swing event thread synchronously. Returns
after the execution is complete.
Source
make-action
function
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.
Source
function
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
add-menu-item function.
Source
var
An atom containing the dispatch set for the add-menu-item method.
Source