APIdia Launch Partner
Top Fields Constructors Methods
com.sun.glass.ui

public abstract Class Cursor

extends Object
Class Inheritance
Known Direct Subclasses
com.sun.glass.ui.gtk.GtkCursor, com.sun.glass.ui.headless.HeadlessCursor, com.sun.glass.ui.ios.IosCursor, com.sun.glass.ui.mac.MacCursor, com.sun.glass.ui.monocle.MonocleCursor, com.sun.glass.ui.win.WinCursor
Imports
java.lang.annotation.Native

Field Summary

Modifier and TypeField and Description
public static final int
public static final int
public static final int
public static final int
public static final int
private static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
private long
private final int

Constructor Summary

AccessConstructor and Description
protected
Cursor(final int type)

protected
Cursor(final int x, final int y, final Pixels pixels)

Method Summary

Modifier and TypeMethod and Description
protected abstract long
_createCursor(int x, int y, Pixels pixels)

public static Size
getBestSize(int width, int height)

Returns the 'best' cursor size based on the given preferred size.

protected final long
public final int
public static void
setVisible(boolean visible)

Shows or hides the cursor.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CURSOR_CLOSED_HANDback to summary
public static final int CURSOR_CLOSED_HAND
Annotations
@Native
CURSOR_CROSSHAIRback to summary
public static final int CURSOR_CROSSHAIR
Annotations
@Native
CURSOR_CUSTOMback to summary
public static final int CURSOR_CUSTOM
Annotations
@Native
CURSOR_DEFAULTback to summary
public static final int CURSOR_DEFAULT
Annotations
@Native
CURSOR_DISAPPEARback to summary
public static final int CURSOR_DISAPPEAR
Annotations
@Native
CURSOR_MAXback to summary
private static final int CURSOR_MAX
CURSOR_MOVEback to summary
public static final int CURSOR_MOVE
Annotations
@Native
CURSOR_NONEback to summary
public static final int CURSOR_NONE
Annotations
@Native
CURSOR_OPEN_HANDback to summary
public static final int CURSOR_OPEN_HAND
Annotations
@Native
CURSOR_POINTING_HANDback to summary
public static final int CURSOR_POINTING_HAND
Annotations
@Native
CURSOR_RESIZE_DOWNback to summary
public static final int CURSOR_RESIZE_DOWN
Annotations
@Native
CURSOR_RESIZE_LEFTback to summary
public static final int CURSOR_RESIZE_LEFT
Annotations
@Native
CURSOR_RESIZE_LEFTRIGHTback to summary
public static final int CURSOR_RESIZE_LEFTRIGHT
Annotations
@Native
CURSOR_RESIZE_NORTHEASTback to summary
public static final int CURSOR_RESIZE_NORTHEAST
Annotations
@Native
CURSOR_RESIZE_NORTHWESTback to summary
public static final int CURSOR_RESIZE_NORTHWEST
Annotations
@Native
CURSOR_RESIZE_RIGHTback to summary
public static final int CURSOR_RESIZE_RIGHT
Annotations
@Native
CURSOR_RESIZE_SOUTHEASTback to summary
public static final int CURSOR_RESIZE_SOUTHEAST
Annotations
@Native
CURSOR_RESIZE_SOUTHWESTback to summary
public static final int CURSOR_RESIZE_SOUTHWEST
Annotations
@Native
CURSOR_RESIZE_UPback to summary
public static final int CURSOR_RESIZE_UP
Annotations
@Native
CURSOR_RESIZE_UPDOWNback to summary
public static final int CURSOR_RESIZE_UPDOWN
Annotations
@Native
CURSOR_TEXTback to summary
public static final int CURSOR_TEXT
Annotations
@Native
CURSOR_WAITback to summary
public static final int CURSOR_WAIT
Annotations
@Native
ptrback to summary
private long ptr
typeback to summary
private final int type

Constructor Detail

Cursorback to summary
protected Cursor(final int type)
Cursorback to summary
protected Cursor(final int x, final int y, final Pixels pixels)

Method Detail

_createCursorback to summary
protected abstract long _createCursor(int x, int y, Pixels pixels)
getBestSizeback to summary
public static Size getBestSize(int width, int height)

Returns the 'best' cursor size based on the given preferred size.

getNativeCursorback to summary
protected final long getNativeCursor()
getTypeback to summary
public final int getType()
setVisibleback to summary
public static void setVisible(boolean visible)

Shows or hides the cursor.

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.