public final class Cursor extends Resource
Application code must explicitly invoke the Cursor.dispose()
method to release the operating system resources managed by each instance
when those instances are no longer required.
Note: Only one of the above styles may be specified.
Modifier and Type | Field and Description |
---|---|
(package private) static byte[] |
HAND_MASK |
(package private) static byte[] |
HAND_SOURCE
data used to create a HAND cursor.
|
int |
handle
the handle to the OS cursor resource
(Warning: This field is platform dependent)
IMPORTANT: This field is not part of the SWT
public API.
|
(package private) boolean |
isIcon |
Constructor and Description |
---|
Cursor(Device device)
Prevents uninitialized instances from being created outside the package.
|
Cursor(Device device,
ImageData source,
ImageData mask,
int hotspotX,
int hotspotY)
Constructs a new cursor given a device, image and mask
data describing the desired cursor appearance, and the x
and y coordinates of the hotspot (that is, the point
within the area covered by the cursor which is considered
to be where the on-screen pointer is "pointing").
|
Cursor(Device device,
ImageData source,
int hotspotX,
int hotspotY)
Constructs a new cursor given a device, image data describing
the desired cursor appearance, and the x and y coordinates of
the hotspot (that is, the point within the area
covered by the cursor which is considered to be where the
on-screen pointer is "pointing").
|
Cursor(Device device,
int style)
Constructs a new cursor given a device and a style
constant describing the desired cursor appearance.
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
destroy() |
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.
|
boolean |
isDisposed()
Returns
true if the cursor has been disposed,
and false otherwise. |
java.lang.String |
toString()
Returns a string containing a concise, human-readable
description of the receiver.
|
static Cursor |
win32_new(Device device,
int handle)
Invokes platform specific functionality to allocate a new cursor.
|
public int handle
IMPORTANT: This field is not part of the SWT public API. It is marked public only so that it can be shared within the packages provided by SWT. It is not available on all platforms and should never be accessed from application code.
boolean isIcon
static final byte[] HAND_SOURCE
static final byte[] HAND_MASK
Cursor(Device device)
public Cursor(Device device, int style)
You must dispose the cursor when it is no longer required.
NOTE: It is recommended to useDisplay.getSystemCursor(int)
instead of using this constructor. This way you can avoid the
overhead of disposing the Cursor resource.device
- the device on which to allocate the cursorstyle
- the style of cursor to allocatejava.lang.IllegalArgumentException
- SWTError
- 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
public Cursor(Device device, ImageData source, ImageData mask, int hotspotX, int hotspotY)
The mask data is allowed to be null, but in this case the source must be an ImageData representing an icon that specifies both color data and mask data.
You must dispose the cursor when it is no longer required.
device
- the device on which to allocate the cursorsource
- the color data for the cursormask
- the mask data for the cursor (or null)hotspotX
- the x coordinate of the cursor's hotspothotspotY
- the y coordinate of the cursor's hotspotjava.lang.IllegalArgumentException
- SWTError
- public Cursor(Device device, ImageData source, int hotspotX, int hotspotY)
You must dispose the cursor when it is no longer required.
device
- the device on which to allocate the cursorsource
- the image data for the cursorhotspotX
- the x coordinate of the cursor's hotspothotspotY
- the y coordinate of the cursor's hotspotjava.lang.IllegalArgumentException
- SWTError
- public boolean equals(java.lang.Object object)
equals
in class java.lang.Object
object
- the object to compare with this objecttrue
if the object is the same as this object and false
otherwisehashCode()
public int hashCode()
true
when passed to
equals
must return the same value for this
method.hashCode
in class java.lang.Object
equals(java.lang.Object)
public boolean isDisposed()
true
if the cursor has been disposed,
and false
otherwise.
This method gets the dispose state for the cursor.
When a cursor has been disposed, it is an error to
invoke any other method (except Resource.dispose()
) using the cursor.
isDisposed
in class Resource
true
when the cursor is disposed and false
otherwisepublic java.lang.String toString()
toString
in class java.lang.Object
public static Cursor win32_new(Device device, int handle)
IMPORTANT: This method is not part of the public
API for Cursor
. It is marked public only so that it
can be shared within the packages provided by SWT. It is not
available on all platforms, and should never be called from
application code.
device
- the device on which to allocate the colorhandle
- the handle for the cursor