public abstract class Cursor extends Object
Modifier and Type | Field and Description |
---|---|
static int |
CURSOR_CLOSED_HAND |
static int |
CURSOR_CROSSHAIR |
static int |
CURSOR_CUSTOM |
static int |
CURSOR_DEFAULT |
static int |
CURSOR_DISAPPEAR |
static int |
CURSOR_MOVE |
static int |
CURSOR_NONE |
static int |
CURSOR_OPEN_HAND |
static int |
CURSOR_POINTING_HAND |
static int |
CURSOR_RESIZE_DOWN |
static int |
CURSOR_RESIZE_LEFT |
static int |
CURSOR_RESIZE_LEFTRIGHT |
static int |
CURSOR_RESIZE_NORTHEAST |
static int |
CURSOR_RESIZE_NORTHWEST |
static int |
CURSOR_RESIZE_RIGHT |
static int |
CURSOR_RESIZE_SOUTHEAST |
static int |
CURSOR_RESIZE_SOUTHWEST |
static int |
CURSOR_RESIZE_UP |
static int |
CURSOR_RESIZE_UPDOWN |
static int |
CURSOR_TEXT |
static int |
CURSOR_WAIT |
Modifier | Constructor and Description |
---|---|
protected |
Cursor(int type) |
protected |
Cursor(int x,
int y,
Pixels pixels) |
Modifier and Type | Method and Description |
---|---|
protected abstract long |
_createCursor(int x,
int y,
Pixels pixels) |
static Size |
getBestSize(int width,
int height)
Returns the 'best' cursor size based on the given preferred size.
|
protected long |
getNativeCursor() |
int |
getType() |
static void |
setVisible(boolean visible)
Shows or hides the cursor.
|
public static final int CURSOR_NONE
public static final int CURSOR_CUSTOM
public static final int CURSOR_DEFAULT
public static final int CURSOR_TEXT
public static final int CURSOR_CROSSHAIR
public static final int CURSOR_CLOSED_HAND
public static final int CURSOR_OPEN_HAND
public static final int CURSOR_POINTING_HAND
public static final int CURSOR_RESIZE_LEFT
public static final int CURSOR_RESIZE_RIGHT
public static final int CURSOR_RESIZE_UP
public static final int CURSOR_RESIZE_DOWN
public static final int CURSOR_RESIZE_LEFTRIGHT
public static final int CURSOR_RESIZE_UPDOWN
public static final int CURSOR_DISAPPEAR
public static final int CURSOR_WAIT
public static final int CURSOR_RESIZE_SOUTHWEST
public static final int CURSOR_RESIZE_SOUTHEAST
public static final int CURSOR_RESIZE_NORTHWEST
public static final int CURSOR_RESIZE_NORTHEAST
public static final int CURSOR_MOVE
protected Cursor(int type)
protected Cursor(int x, int y, Pixels pixels)
public final int getType()
protected final long getNativeCursor()
public static void setVisible(boolean visible)
If the cursor is currently hidden with a previous call to setVisible(false)
, setting a new cursor shape (e.g. by means of calling
Window.setCursor()
) does not automatically display the cursor on
the screen until the client code calls setVisible(true)
to show
the cursor again.
If the mouse cursor is located over a non-Glass window at the time of calling this method, the call may or may not affect the native cursor's visibility. This behavior is platform-dependent.
When the mouse pointer is moved over a non-Glass window, depending on
the native platform behavior, the cursor may or may not become visible
on the screen, even if it was previously hidden by calling setVisible(false)
. After this occurs, on some platforms the cursor may
even remain visible permanently. For example, Mac OS X makes the cursor
visible unconditionally when the mouse is moved over the Dock or Menu
Bar areas. There's no way to detect that the native cursor became
visible, however, from Glass perspective it is still considered hidden,
and thus, when the mouse cursor is needed again, the app should call
setVisible(true)
in order to continue to operate properly.
Calling this method multiple times with the same argument may not have
any effect. For example, if the cursor was hidden and the native OS
restored its visibility, calling setVisible(false)
again may not
hide the cursor. If the app needs to ultimately hide the cursor, it
should first show the cursor again, and then proceed with hiding it.
public static Size getBestSize(int width, int height)
protected abstract long _createCursor(int x, int y, Pixels pixels)
Copyright © 2020. All rights reserved.