java.awt
Class Cursor

java.lang.Object
  extended by java.awt.Cursor
All Implemented Interfaces:
Serializable

public class Cursor
extends Object
implements Serializable

This class represents various predefined cursor types.

See Also:
Serialized Form

Field Summary
static int CROSSHAIR_CURSOR
          Constant for a cross-hair cursor.
static int CUSTOM_CURSOR
           
static int DEFAULT_CURSOR
          Constant for the system default cursor type
static int E_RESIZE_CURSOR
          Cursor used over E edge of window decorations.
static int HAND_CURSOR
          Constant for a hand cursor.
static int MOVE_CURSOR
          Constant for a cursor used during window move operations.
static int N_RESIZE_CURSOR
          Cursor used over N edge of window decorations.
protected  String name
           
static int NE_RESIZE_CURSOR
          Cursor used over NE corner of window decorations.
static int NW_RESIZE_CURSOR
          Cursor used over NW corner of window decorations.
protected static Cursor[] predefined
           
static int S_RESIZE_CURSOR
          Cursor used over S edge of window decorations.
static int SE_RESIZE_CURSOR
          Cursor used over SE corner of window decorations.
static int SW_RESIZE_CURSOR
          Cursor used over SW corner of window decorations.
static int TEXT_CURSOR
          Constant for a cursor over a text field.
static int W_RESIZE_CURSOR
          Cursor used over W edge of window decorations.
static int WAIT_CURSOR
          Constant for a cursor to display while waiting for an action to complete.
 
Constructor Summary
  Cursor(int type)
          Initializes a new instance of Cursor with the specified type.
protected Cursor(String name)
          This constructor is used internally only.
 
Method Summary
static Cursor getDefaultCursor()
          Returns an instance of the system default cursor type.
 String getName()
           
static Cursor getPredefinedCursor(int type)
          Returns an instance of Cursor for one of the specified predetermined types.
static Cursor getSystemCustomCursor(String name)
          Retrieves the system specific custom Cursor named Cursor names are, for example: "Invalid.16x16".
 int getType()
          Returns the numeric type identifier for this cursor.
 String toString()
          Convert this Object to a human-readable String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_CURSOR

public static final int DEFAULT_CURSOR
Constant for the system default cursor type

See Also:
Constant Field Values

CROSSHAIR_CURSOR

public static final int CROSSHAIR_CURSOR
Constant for a cross-hair cursor.

See Also:
Constant Field Values

TEXT_CURSOR

public static final int TEXT_CURSOR
Constant for a cursor over a text field.

See Also:
Constant Field Values

WAIT_CURSOR

public static final int WAIT_CURSOR
Constant for a cursor to display while waiting for an action to complete.

See Also:
Constant Field Values

SW_RESIZE_CURSOR

public static final int SW_RESIZE_CURSOR
Cursor used over SW corner of window decorations.

See Also:
Constant Field Values

SE_RESIZE_CURSOR

public static final int SE_RESIZE_CURSOR
Cursor used over SE corner of window decorations.

See Also:
Constant Field Values

NW_RESIZE_CURSOR

public static final int NW_RESIZE_CURSOR
Cursor used over NW corner of window decorations.

See Also:
Constant Field Values

NE_RESIZE_CURSOR

public static final int NE_RESIZE_CURSOR
Cursor used over NE corner of window decorations.

See Also:
Constant Field Values

N_RESIZE_CURSOR

public static final int N_RESIZE_CURSOR
Cursor used over N edge of window decorations.

See Also:
Constant Field Values

S_RESIZE_CURSOR

public static final int S_RESIZE_CURSOR
Cursor used over S edge of window decorations.

See Also:
Constant Field Values

W_RESIZE_CURSOR

public static final int W_RESIZE_CURSOR
Cursor used over W edge of window decorations.

See Also:
Constant Field Values

E_RESIZE_CURSOR

public static final int E_RESIZE_CURSOR
Cursor used over E edge of window decorations.

See Also:
Constant Field Values

HAND_CURSOR

public static final int HAND_CURSOR
Constant for a hand cursor.

See Also:
Constant Field Values

MOVE_CURSOR

public static final int MOVE_CURSOR
Constant for a cursor used during window move operations.

See Also:
Constant Field Values

CUSTOM_CURSOR

public static final int CUSTOM_CURSOR
See Also:
Constant Field Values

predefined

protected static Cursor[] predefined

name

protected String name
Constructor Detail

Cursor

public Cursor(int type)
Initializes a new instance of Cursor with the specified type.

Parameters:
type - The cursor type.
Throws:
IllegalArgumentException - If the specified cursor type is invalid

Cursor

protected Cursor(String name)
This constructor is used internally only. Application code should call Toolkit.createCustomCursor().

Method Detail

getPredefinedCursor

public static Cursor getPredefinedCursor(int type)
Returns an instance of Cursor for one of the specified predetermined types.

Parameters:
type - The type contant from this class.
Returns:
The requested predefined cursor.
Throws:
IllegalArgumentException - If the constant is not one of the predefined cursor type constants from this class.

getSystemCustomCursor

public static Cursor getSystemCustomCursor(String name)
                                    throws AWTException
Retrieves the system specific custom Cursor named Cursor names are, for example: "Invalid.16x16".

Throws:
AWTException
HeadlessException - If GraphicsEnvironment.isHeadless() returns true.

getDefaultCursor

public static Cursor getDefaultCursor()
Returns an instance of the system default cursor type.

Returns:
The system default cursor.

getType

public int getType()
Returns the numeric type identifier for this cursor.

Returns:
The cursor id.

getName

public String getName()

toString

public String toString()
Description copied from class: Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() and such.

It is typical, but not required, to ensure that this method never completes abruptly with a RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).

Overrides:
toString in class Object
Returns:
the String representing this Object, which may be null
See Also:
Object.getClass(), Object.hashCode(), Class.getName(), Integer.toHexString(int)