Top Description Inners Fields Constructors Methods
java.awt

public Class Cursor

extends Object
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Known Direct Subclasses
javax.swing.plaf.basic.BasicTextUI.BasicCursor, sun.awt.CustomCursor
Imports
java.beans.ConstructorProperties, java.io.InputStream, .Serial, java.security.AccessController, .PrivilegedAction, .PrivilegedExceptionAction, java.util.Hashtable, .Properties, .StringTokenizer, sun.awt.AWTAccessor, sun.util.logging.PlatformLogger

A class to encapsulate the bitmap representation of the mouse cursor.
Author
Amy Fowler
See Also
Component#setCursor

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
private transient Object
public static final int
CROSSHAIR_CURSOR

The crosshair cursor type.

private static final String
pack-priv static final String[][]
public static final int
CUSTOM_CURSOR

The type associated with all custom cursors.

public static final int
DEFAULT_CURSOR

The default cursor type (gets set if no cursor is defined).

pack-priv transient Cursor.CursorDisposer
private static final String
private static final String
private static final String
public static final int
E_RESIZE_CURSOR

The east-resize cursor type.

public static final int
HAND_CURSOR

The hand cursor type.

private static final PlatformLogger
public static final int
MOVE_CURSOR

The move cursor type.

public static final int
N_RESIZE_CURSOR

The north-resize cursor type.

protected String
name

The user-visible name of the cursor.

public static final int
NE_RESIZE_CURSOR

The north-east-resize cursor type.

public static final int
NW_RESIZE_CURSOR

The north-west-resize cursor type.

private transient long
pData

Hook into native data.

protected static Cursor[]
predefined

Deprecated As of JDK version 1.7, the getPredefinedCursor(int) method should be used instead.
private static final Cursor[]
predefinedPrivate

This field is a private replacement for 'predefined' array.

private static final String
private static final String
public static final int
S_RESIZE_CURSOR

The south-resize cursor type.

public static final int
SE_RESIZE_CURSOR

The south-east-resize cursor type.

private static final long
serialVersionUID

Use serialVersionUID from JDK 1.1 for interoperability.

public static final int
SW_RESIZE_CURSOR

The south-west-resize cursor type.

private static Properties
private static final Hashtable<String, Cursor>
public static final int
TEXT_CURSOR

The text cursor type.

pack-priv int
type

The chosen cursor type initially set to the DEFAULT_CURSOR.

public static final int
W_RESIZE_CURSOR

The west-resize cursor type.

public static final int
WAIT_CURSOR

The wait cursor type.

Constructor Summary

AccessConstructor and Description
public
Cursor(int
the type of cursor
type
)

Creates a new cursor object with the specified type.

protected
Cursor(String
the user-visible name of the cursor.
name
)

Creates a new custom cursor object with the specified name.

Method Summary

Modifier and TypeMethod and Description
private static native void
finalizeImpl(long pData)

public static Cursor

Returns:

the default cursor
getDefaultCursor
()

Return the system default cursor.

public String

Returns:

a localized description of this cursor.
getName
()

Returns the name of this cursor.

public static Cursor

Returns:

the specified predefined cursor
getPredefinedCursor
(int
the type of predefined cursor
type
)

Returns a cursor object with the specified predefined type.

public static Cursor

Returns:

the system specific custom cursor named
getSystemCustomCursor
(final String
a string describing the desired system-specific custom cursor
name
)

Returns a system-specific custom cursor object matching the specified name.

public int

Returns:

the cursor type
getType
()

Returns the type for this cursor.

private static native void
initIDs()

Initialize JNI field and method IDs for fields that may be accessed from C.

private static void
private void
setPData(long pData)

public String

Returns:

a string representation of this cursor.
toString
()

Overrides java.lang.Object.toString.

Returns a string representation of this cursor.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

anchorback to summary
private transient Object anchor
CROSSHAIR_CURSORback to summary
public static final int CROSSHAIR_CURSOR

The crosshair cursor type.

CURSOR_DOT_PREFIXback to summary
private static final String CURSOR_DOT_PREFIX
cursorPropertiesback to summary
pack-priv static final String[][] cursorProperties
CUSTOM_CURSORback to summary
public static final int CUSTOM_CURSOR

The type associated with all custom cursors.

DEFAULT_CURSORback to summary
public static final int DEFAULT_CURSOR

The default cursor type (gets set if no cursor is defined).

disposerback to summary
pack-priv transient Cursor.CursorDisposer disposer
DOT_FILE_SUFFIXback to summary
private static final String DOT_FILE_SUFFIX
DOT_HOTSPOT_SUFFIXback to summary
private static final String DOT_HOTSPOT_SUFFIX
DOT_NAME_SUFFIXback to summary
private static final String DOT_NAME_SUFFIX
E_RESIZE_CURSORback to summary
public static final int E_RESIZE_CURSOR

The east-resize cursor type.

HAND_CURSORback to summary
public static final int HAND_CURSOR

The hand cursor type.

logback to summary
private static final PlatformLogger log
MOVE_CURSORback to summary
public static final int MOVE_CURSOR

The move cursor type.

N_RESIZE_CURSORback to summary
public static final int N_RESIZE_CURSOR

The north-resize cursor type.

nameback to summary
protected String name

The user-visible name of the cursor.

See Also
getName()
NE_RESIZE_CURSORback to summary
public static final int NE_RESIZE_CURSOR

The north-east-resize cursor type.

NW_RESIZE_CURSORback to summary
public static final int NW_RESIZE_CURSOR

The north-west-resize cursor type.

pDataback to summary
private transient long pData

Hook into native data.

predefinedback to summary
protected static Cursor[] predefined

Deprecated

As of JDK version 1.7, the getPredefinedCursor(int) method should be used instead.

Annotations
@Deprecated
predefinedPrivateback to summary
private static final Cursor[] predefinedPrivate

This field is a private replacement for 'predefined' array.

PROPERTIES_FILEback to summary
private static final String PROPERTIES_FILE
RESOURCE_PREFIXback to summary
private static final String RESOURCE_PREFIX
S_RESIZE_CURSORback to summary
public static final int S_RESIZE_CURSOR

The south-resize cursor type.

SE_RESIZE_CURSORback to summary
public static final int SE_RESIZE_CURSOR

The south-east-resize cursor type.

serialVersionUIDback to summary
private static final long serialVersionUID

Use serialVersionUID from JDK 1.1 for interoperability.

Annotations
@Serial
SW_RESIZE_CURSORback to summary
public static final int SW_RESIZE_CURSOR

The south-west-resize cursor type.

systemCustomCursorPropertiesback to summary
private static Properties systemCustomCursorProperties
systemCustomCursorsback to summary
private static final Hashtable<String, Cursor> systemCustomCursors
TEXT_CURSORback to summary
public static final int TEXT_CURSOR

The text cursor type.

typeback to summary
pack-priv int type

The chosen cursor type initially set to the DEFAULT_CURSOR.

See Also
getType()
W_RESIZE_CURSORback to summary
public static final int W_RESIZE_CURSOR

The west-resize cursor type.

WAIT_CURSORback to summary
public static final int WAIT_CURSOR

The wait cursor type.

Constructor Detail

Cursorback to summary
public Cursor(int type)

Creates a new cursor object with the specified type.

Parameters
type:int

the type of cursor

Annotations
@ConstructorProperties:type
Exceptions
IllegalArgumentException:
if the specified cursor type is invalid
Cursorback to summary
protected Cursor(String name)

Creates a new custom cursor object with the specified name.

Note

this constructor should only be used by AWT implementations as part of their support for custom cursors. Applications should use Toolkit.createCustomCursor().

Parameters
name:String

the user-visible name of the cursor.

See Also
java.awt.Toolkit#createCustomCursor

Method Detail

finalizeImplback to summary
private static native void finalizeImpl(long pData)
getDefaultCursorback to summary
public static Cursor getDefaultCursor()

Return the system default cursor.

Returns:Cursor

the default cursor

getNameback to summary
public String getName()

Returns the name of this cursor.

Returns:String

a localized description of this cursor.

Since
1.2
getPredefinedCursorback to summary
public static Cursor getPredefinedCursor(int type)

Returns a cursor object with the specified predefined type.

Parameters
type:int

the type of predefined cursor

Returns:Cursor

the specified predefined cursor

Exceptions
IllegalArgumentException:
if the specified cursor type is invalid
getSystemCustomCursorback to summary
public static Cursor getSystemCustomCursor(final String name) throws AWTException, HeadlessException

Returns a system-specific custom cursor object matching the specified name. Cursor names are, for example: "Invalid.16x16"

Parameters
name:String

a string describing the desired system-specific custom cursor

Returns:Cursor

the system specific custom cursor named

Exceptions
AWTException:
in case of erroneous retrieving of the cursor
HeadlessException:
if GraphicsEnvironment.isHeadless returns true
getTypeback to summary
public int getType()

Returns the type for this cursor.

Returns:int

the cursor type

initIDsback to summary
private static native void initIDs()

Initialize JNI field and method IDs for fields that may be accessed from C.

loadSystemCustomCursorPropertiesback to summary
private static void loadSystemCustomCursorProperties() throws AWTException
Annotations
@SuppressWarnings:removal
setPDataback to summary
private void setPData(long pData)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Returns a string representation of this cursor.

Returns:String

a string representation of this cursor.

Since
1.2
java.awt back to summary

pack-priv Class Cursor.CursorDisposer

extends Object
implements DisposerRecord
Class Inheritance
All Implemented Interfaces
sun.java2d.DisposerRecord

Field Summary

Modifier and TypeField and Description
pack-priv volatile long

Constructor Summary

AccessConstructor and Description
public
CursorDisposer(long pData)

Method Summary

Modifier and TypeMethod and Description
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

pDataback to summary
pack-priv volatile long pData

Constructor Detail

CursorDisposerback to summary
public CursorDisposer(long pData)

Method Detail

disposeback to summary
public void dispose()

Implements sun.java2d.DisposerRecord.dispose.