@@ -59,26 +59,29 @@ public final class Cursor extends Resource {
5959 * platforms and should never be accessed from application code.
6060 * </p>
6161 *
62- * @noreference This field is not intended to be referenced by clients.
6362 */
64- public long handle ;
63+ private long handle ;
6564 /**
6665 * Attribute to cache current native zoom level
6766 */
68- private static int DEFAULT_ZOOM = 100 ;
67+ private static final int DEFAULT_ZOOM = 100 ;
6968
7069 private HashMap <Integer , Long > zoomLevelToHandle = new HashMap <>();
7170
7271 boolean isIcon ;
73- private ImageData source ;
74- private ImageData mask ;
75- private int hotspotX ;
76- private int hotspotY ;
72+ private final ImageData source ;
73+ private final ImageData mask ;
74+ private final int hotspotX ;
75+ private final int hotspotY ;
7776/**
7877 * Prevents uninitialized instances from being created outside the package.
7978 */
8079Cursor (Device device ) {
8180 super (device );
81+ this .source = null ;
82+ this .mask = null ;
83+ this .hotspotX = -1 ;
84+ this .hotspotY = -1 ;
8285}
8386
8487/**
@@ -128,7 +131,7 @@ public final class Cursor extends Resource {
128131 * @see #dispose()
129132 */
130133public Cursor (Device device , int style ) {
131- super (device );
134+ this (device );
132135 long lpCursorName = 0 ;
133136 switch (style ) {
134137 case SWT .CURSOR_HAND : lpCursorName = OS .IDC_HAND ; break ;
@@ -263,6 +266,7 @@ public Cursor(Device device, ImageData source, ImageData mask, int hotspotX, int
263266public Cursor (Device device , ImageData source , int hotspotX , int hotspotY ) {
264267 super (device );
265268 this .source = source ;
269+ this .mask = null ;
266270 this .hotspotX = hotspotX ;
267271 this .hotspotY = hotspotY ;
268272 if (source == null ) SWT .error (SWT .ERROR_NULL_ARGUMENT );
@@ -345,12 +349,12 @@ public Cursor(Device device, ImageData source, int hotspotX, int hotspotY) {
345349 * available on all platforms, and should never be called from
346350 * application code.
347351 *
348- * Updates zoom and refresh the Cursor based on the native zoom level, if required .
352+ * Get the handle for a cursor given a zoom level.
349353 *
350- * @param cursor the cursor to get the handle of
351- * @param zoom device zoom in % of the monitor on which the image is painted
354+ * @param cursor the cursor
355+ * @param zoom zoom level ( in %) of the monitor the cursor is currently in.
352356 *
353- * @return true if cursor is refreshed
357+ * @return The handle of the cursor.
354358 *
355359 * @noreference This method is not intended to be referenced by clients.
356360 */
0 commit comments