API for seesaw.cursor
-
by Dave Ray
Full namespace name:
seesaw.cursor
Overview
Functions for creating Swing cursors.
Public Variables and Functions
cursor
function
Usage: (cursor type & args)
Create a built-in or custom cursor. Take one of two forms:
(cursor :name-of-built-in-cursor)
Creates a built-in cursor of the given type. Valid types are:
:crosshair :custom :default :hand :move :text :wait
:e-resize :n-resize :ne-resize :nw-resize
:s-resize :se-resize :sw-resize :w-resize
To create custom cursor:
(cursor image-or-icon optional-hotspot)
where image-or-icon is a java.awt.Image (see seesaw.graphics/buffered-image)
or javax.swing.ImageIcon (see seesaw.icon/icon). The hotspot is an optional
[x y] point indicating the click point for the cursor. Defaults to [0 0].
Examples:
; The hand cursor
(cursor :hand)
; Create a custom cursor from a URL:
(cursor (icon "http://path/to/my/cursor.png") [5 5])
Notes:
This function is used implicitly by the :cursor option on most widget
constructor functions. So
(label :cursor (cursor :hand))
is equivalent to:
(label :cursor :hand)
Same for setting the cursor with (seesaw.core/config!).
Also, the size of a cursor is platform dependent, so some experimentation
will be required with creating custom cursors from images.
See:
http://download.oracle.com/javase/6/docs/api/java/awt/Cursor.html
http://download.oracle.com/javase/6/docs/api/java/awt/Toolkit.html#createCustomCursor%28java.awt.Image,%20java.awt.Point,%20java.lang.String%29