jruby/docs BETA
org.eclipse.swt.graphics 36
E AutoscalingMode
C Color
C Cursor
C Device
C DeviceData
I Drawable
C Font
C FontData
C FontMetrics
C GC
C GCData
C GlyphMetrics
C Image
C ImageData
I ImageDataAtSizeProvider
I ImageDataProvider
I ImageFileNameProvider
I ImageGcDrawer
C ImageLoader
C ImageLoaderEvent
I ImageLoaderListener
C LineAttributes
C PaletteData
C Path
C PathData
C Pattern
C Point
C RGB
C RGBA
C Rectangle
C Region
C Resource
E RoundingMode
C TextLayout
C TextStyle
C Transform
Cursor — members 10+
F handle() NSCursor
C new(device, style)
C new(device, source, mask, hotspot_x, hotspot_y)
C new(device, source, hotspot_x, hotspot_y)
C new(device, image_data_provider, hotspot_x, hotspot_y)
M cocoa_new(device, handle) Cursor
M disposed?() boolean
M equals(object) boolean
M hash_code() int
M to_string() String
from Resource
M device() Device
C dispose()

org.eclipse.swt.graphics.Cursor

class final extends Resource 10 members

Instances of this class manage operating system resources that specify the appearance of the on-screen pointer. To create a cursor you specify the device and either a simple cursor style describing one of the standard operating system provided cursors or the image and mask data for the desired appearance.

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.

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.

Fields

fieldtypenote
handle NSCursor the handle to the OS cursor resource (Warning: This field is platform dependent)

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.

Constructors

new

new ( Device device, int style )
Java: <init>(org.eclipse.swt.graphics.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 org.eclipse.swt.widgets.Display#getSystemCursor(int) instead of using this constructor. This way you can avoid the overhead of disposing the Cursor resource.

nametypedescription
deviceorg.eclipse.swt.graphics.Devicethe device on which to allocate the cursor
styleintthe style of cursor to allocate

Throws

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

new

new ( Device device, ImageData source, ImageData mask, int hotspot_x, int hotspot_y )
Java: <init>(org.eclipse.swt.graphics.Device device, org.eclipse.swt.graphics.ImageData source, org.eclipse.swt.graphics.ImageData mask, int hotspotX, int hotspotY)
Deprecated. Use #Cursor(Device, ImageDataProvider, int, int) instead.

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").

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.

nametypedescription
deviceorg.eclipse.swt.graphics.Devicethe device on which to allocate the cursor
sourceorg.eclipse.swt.graphics.ImageDatathe color data for the cursor
maskorg.eclipse.swt.graphics.ImageDatathe mask data for the cursor (or null)
hotspot_xintthe x coordinate of the cursor's hotspot
hotspot_yintthe y coordinate of the cursor's hotspot

Throws

IllegalArgumentException
  • ERROR_NULL_ARGUMENT - if device is null and there is no current device
  • ERROR_NULL_ARGUMENT - if the source is null
  • ERROR_NULL_ARGUMENT - if the mask is null and the source does not have a mask
  • ERROR_INVALID_ARGUMENT - if the source and the mask are not the same size, or if the hotspot is outside the bounds of the image
SWTError
  • ERROR_NO_HANDLES - if a handle could not be obtained for cursor creation

new

new ( Device device, ImageData source, int hotspot_x, int hotspot_y )
Java: <init>(org.eclipse.swt.graphics.Device device, org.eclipse.swt.graphics.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").

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

nametypedescription
deviceorg.eclipse.swt.graphics.Devicethe device on which to allocate the cursor
sourceorg.eclipse.swt.graphics.ImageDatathe image data for the cursor
hotspot_xintthe x coordinate of the cursor's hotspot
hotspot_yintthe y coordinate of the cursor's hotspot

Throws

IllegalArgumentException
  • ERROR_NULL_ARGUMENT - if device is null and there is no current device
  • ERROR_NULL_ARGUMENT - if the image is null
  • ERROR_INVALID_ARGUMENT - if the hotspot is outside the bounds of the image
SWTError
  • ERROR_NO_HANDLES - if a handle could not be obtained for cursor creation

new

new ( Device device, ImageDataProvider image_data_provider, int hotspot_x, int hotspot_y )
Java: <init>(org.eclipse.swt.graphics.Device device, org.eclipse.swt.graphics.ImageDataProvider imageDataProvider, int hotspotX, int hotspotY)

Constructs a new cursor given a device, image 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").

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

nametypedescription
deviceorg.eclipse.swt.graphics.Devicethe device on which to allocate the cursor
image_data_providerorg.eclipse.swt.graphics.ImageDataProviderthe ImageDataProvider for the cursor
hotspot_xintthe x coordinate of the cursor's hotspot
hotspot_yintthe y coordinate of the cursor's hotspot

Throws

IllegalArgumentException
  • ERROR_NULL_ARGUMENT - if device is null and there is no current device
  • ERROR_NULL_ARGUMENT - if the image is null
  • ERROR_INVALID_ARGUMENT - if the hotspot is outside the bounds of the image
SWTError
  • ERROR_NO_HANDLES - if a handle could not be obtained for cursor creation

Class Methods

cocoa_new

Cursor cocoa_new ( Device device, NSCursor handle )
Java: cocoa_new(org.eclipse.swt.graphics.Device device, org.eclipse.swt.internal.cocoa.NSCursor handle)

Invokes platform specific functionality to allocate a new cursor.

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.

nametypedescription
deviceorg.eclipse.swt.graphics.Devicethe device on which to allocate the color
handleorg.eclipse.swt.internal.cocoa.NSCursorthe handle for the cursor

Instance Methods

disposed?

boolean disposed? ( )
Java: isDisposed() · also: is_disposed

Returns 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 #dispose()) using the cursor.

Returns: true when the cursor is disposed and false otherwise

equals

boolean equals ( Object object )
Java: equals(Object object)

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

nametypedescription
objectObjectthe object to compare with this object

Returns: true if the object is the same as this object and false otherwise

hash_code

int hash_code ( )
Java: 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.

Returns: the receiver's hash

to_string

String to_string ( )
Java: toString()

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

Returns: a string representation of the receiver

Inherited

from Resource

device

Device device ( )
Java: getDevice() · also: get_device

Returns the Device where this resource was created.

Returns: Device the device of the receiver

dispose

dispose ( )
Java: dispose()

Disposes of the operating system resources associated with this resource. Applications must dispose of all resources which they allocate. This method does nothing if the resource is already disposed.