org.eclipse.swt.graphics

## Class Cursor

- java.lang.Object
- - org.eclipse.swt.graphics.Resource
  - - org.eclipse.swt.graphics.Cursor

    public class Cursor
    extends Resource

Instances of this class manage operating system resources that specify the appearance of the on-screen pointer.

To obtain cursors, it is recommended to use one of the `getSystemCursor` method from class `Display`.

Styles:
  CURSOR_ARROW, CURSOR_WAIT, CURSOR_CROSS, CURSOR_APPSTARTING, CURSOR_HELP, CURSOR_SIZEALL, CURSOR_SIZENESW, CURSOR_SIZENS, CURSOR_SIZENWSE, CURSOR_SIZEWE, CURSOR_SIZEN, CURSOR_SIZES, CURSOR_SIZEE, CURSOR_SIZEW, CURSOR_SIZENE, CURSOR_SIZESE, CURSOR_SIZESW, CURSOR_SIZENW, CURSOR_UPARROW, CURSOR_IBEAM, CURSOR_NO, CURSOR_HAND

Note: Only one of the above styles may be specified.

Since:
  1.2

### Constructor Summary

Constructors
Constructor and Description
`Cursor(Device device, int style)` Constructs a new cursor given a device and a style constant describing the desired cursor appearance.

### Method Summary

All Methods Instance Methods Concrete Methods
`boolean` `equals(java.lang.Object object)` Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison.
`int` `hashCode()` Returns an integer hash code for the receiver.
`java.lang.String` `toString()` Returns a string containing a concise, human-readable description of the receiver.

### Methods inherited from class org.eclipse.swt.graphics.Resource

`dispose, getDevice, isDisposed`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### Cursor

    public Cursor(Device device,
                  int style)

Constructs a new cursor given a device and a style constant describing the desired cursor appearance.

You must dispose the cursor when it is no longer required.

NOTE: It is recommended to use `Display.getSystemCursor(int)` instead of using this constructor. This way you can avoid the overhead of disposing the Cursor resource.

Parameters:
  `device` - the device on which to allocate the cursor
  `style` - the style of cursor to allocate
Throws:
  `java.lang.IllegalArgumentException` -
  - ERROR_NULL_ARGUMENT - if device is null and there is no current device
  - ERROR_INVALID_ARGUMENT - when an unknown style is specified
  `SWTError` -
  - ERROR_NO_HANDLES - if a handle could not be obtained for cursor creation
Since:
  1.3
See Also:
  `SWT.CURSOR_ARROW`, `SWT.CURSOR_WAIT`, `SWT.CURSOR_CROSS`, `SWT.CURSOR_APPSTARTING`, `SWT.CURSOR_HELP`, `SWT.CURSOR_SIZEALL`, `SWT.CURSOR_SIZENESW`, `SWT.CURSOR_SIZENS`, `SWT.CURSOR_SIZENWSE`, `SWT.CURSOR_SIZEWE`, `SWT.CURSOR_SIZEN`, `SWT.CURSOR_SIZES`, `SWT.CURSOR_SIZEE`, `SWT.CURSOR_SIZEW`, `SWT.CURSOR_SIZENE`, `SWT.CURSOR_SIZESE`, `SWT.CURSOR_SIZESW`, `SWT.CURSOR_SIZENW`, `SWT.CURSOR_UPARROW`, `SWT.CURSOR_IBEAM`, `SWT.CURSOR_NO`, `SWT.CURSOR_HAND`, `Display.getSystemCursor(int)`

### Method Detail

#### equals

    public boolean equals(java.lang.Object object)

Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison.

Overrides:
  `equals` in class `java.lang.Object`
Parameters:
  `object` - the object to compare with this object
Returns:
  `true` if the object is the same as this object and `false` otherwise
See Also:
  `hashCode()`

#### hashCode

    public int hashCode()

Returns an integer hash code for the receiver. Any two objects that return `true` when passed to `equals` must return the same value for this method.

Overrides:
  `hashCode` in class `java.lang.Object`
Returns:
  the receiver's hash
See Also:
  `equals(java.lang.Object)`

#### toString

    public java.lang.String toString()

Returns a string containing a concise, human-readable description of the receiver.

Overrides:
  `toString` in class `java.lang.Object`
Returns:
  a string representation of the receiver

Copyright (c) EclipseSource and others 2002, 2016. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0