JDK-5102378 : Clarify default drag cursor behavior in startDrag() methods
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2004-09-15
  • Updated: 2017-05-16
  • Resolved: 2011-05-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 Other
7 b04Fixed OpenJDK6Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
If non-null cursor is passed to one of startDrag() methods
of java.awt.dnd.DragGestureEvent or java.awt.dnd.DragSource 
classes, then during the DnD operation the cursor isn't
updated. It's confusing for some users (for example,
refer to the bugs 5018702, 4407521, 5101182, 5043688). 
Null cursor should be passed to startDrag() so that the 
cursor is updated during the DnD operation.

There was the bug 4455820 on the same issue, but it was fixed 
poorly: some words about null cursor and the default drag cursor 
behavior were added only to the javadoc for the class 
java.awt.dnd.DragSourceContext. This isn't sufficient since
programmers typically use startDrag() of DragGestureEvent and 
DragSource. So the null cursor behavior should be documented 
in startDrag() methods of DragGestureEvent and DragSource.

###@###.### 2004-09-15
###@###.### 2004-09-15

Comments
EVALUATION I've written another piece of specification for DragSource. It relates to using a custom drag cursor. See an update in suggested fix section.
11-09-2006

SUGGESTED FIX The approved webrev revision was copied to NFS: /net/jano.sfbay/export/disk29/jcg/1.7.0-dolphin/awt/5102378 URL: http://javaweb.sfbay/jcg/1.7.0-dolphin/awt/5102378/
11-09-2006

SUGGESTED FIX ------- DragGestureEvent.java ------- --- /tmp/sccs.h_aG3q Mon Sep 11 10:16:15 2006 +++ DragGestureEvent.java Mon Sep 11 10:08:20 2006 @@ -178,21 +178,25 @@ /** * Starts the drag operation given the <code>Cursor</code> for this drag * operation and the <code>Transferable</code> representing the source data * for this drag operation. * <br> * If a <code>null</code> <code>Cursor</code> is specified no exception will * be thrown and default drag cursors will be used instead. * <br> * If a <code>null</code> <code>Transferable</code> is specified * <code>NullPointerException</code> will be thrown. - * + * <br> + * Note, that if {@code Cursor} is specified, i.e. drag cursor parameter + * is not a {@code null}, it should be set as a current drag cursor + * and default cursor handling would be disabled for the drag operation. + * * @param dragCursor The <code>Cursor</code> for this drag operation * @param transferable The <code>Transferable</code> representing the source * data for this drag operation. * * @throws <code>InvalidDnDOperationException</code> if the Drag and Drop * system is unable to initiate a drag operation, or if the user * attempts to start a drag while an existing drag operation is * still executing. * @throws <code>NullPointerException</code> if the * <code>Transferable</code> is <code>null</code>. @@ -200,49 +204,57 @@ */ public void startDrag(Cursor dragCursor, Transferable transferable) throws InvalidDnDOperationException { dragSource.startDrag(this, dragCursor, transferable, null); } /** * Starts the drag given the initial <code>Cursor</code> to display, * the <code>Transferable</code> object, * and the <code>DragSourceListener</code> to use. - * <P> + * <br> + * Note, that if {@code Cursor} is specified, i.e. drag cursor parameter + * is not a {@code null}, it should be set as a current drag cursor + * and default cursor handling would be disabled for the drag operation. + * * @param dragCursor The initial drag Cursor * @param transferable The source's Transferable - * @param dsl The source's DragSourceListener - * <P> + * @param dsl The source's DragSourceListener + * <br> * @throws <code>InvalidDnDOperationException</code> if * the Drag and Drop system is unable to * initiate a drag operation, or if the user * attempts to start a drag while an existing * drag operation is still executing. */ public void startDrag(Cursor dragCursor, Transferable transferable, DragSourceListener dsl) throws InvalidDnDOperationException { dragSource.startDrag(this, dragCursor, transferable, dsl); } /** * Start the drag given the initial <code>Cursor</code> to display, * a drag <code>Image</code>, the offset of * the <code>Image</code>, * the <code>Transferable</code> object, and * the <code>DragSourceListener</code> to use. - * <P> + * <br> + * Note, that if {@code Cursor} is specified, i.e. drag cursor parameter + * is not a {@code null}, it should be set as a current drag cursor + * and default cursor handling would be disabled for the drag operation. + * * @param dragCursor The initial drag Cursor * @param dragImage The source's dragImage * @param imageOffset The dragImage's offset * @param transferable The source's Transferable - * @param dsl The source's DragSourceListener - * <P> + * @param dsl The source's DragSourceListener + * <br> * @throws <code>InvalidDnDOperationException</code> if * the Drag and Drop system is unable to * initiate a drag operation, or if the user * attempts to start a drag while an existing * drag operation is still executing. */ public void startDrag(Cursor dragCursor, Image dragImage, Point imageOffset, Transferable transferable, DragSourceListener dsl) throws InvalidDnDOperationException { dragSource.startDrag(this, dragCursor, dragImage, imageOffset, transferable, dsl); }
11-09-2006

SUGGESTED FIX ------- DragSource.java ------- --- /tmp/sccs.IiaWkq Mon Sep 11 09:14:24 2006 +++ DragSource.java Mon Sep 11 09:03:36 2006 @@ -252,20 +252,23 @@ * that initiated the drag, the initial * <code>Cursor</code> to use, * the <code>Image</code> to drag, * the offset of the <code>Image</code> origin * from the hotspot of the <code>Cursor</code> at * the instant of the trigger, * the <code>Transferable</code> subject data * of the drag, the <code>DragSourceListener</code>, * and the <code>FlavorMap</code>. * <P> + * Note, that if {@code Cursor} is specified, i.e. drag cursor parameter + * is not a {@code null}, it should be set as a current drag cursor + * and default cursor handling would be disabled for the drag operation. * @param trigger the <code>DragGestureEvent</code> that initiated the drag * @param dragCursor the initial <code>Cursor</code> or <code>null</code> for defaults * @param dragImage the image to drag or null, * @param imageOffset the offset of the <code>Image</code> origin from the hotspot * of the <code>Cursor</code> at the instant of the trigger * @param transferable the subject data of the drag * @param dsl the <code>DragSourceListener</code> * @param flavorMap the <code>FlavorMap</code> to use, or <code>null</code> * <P> * @throws <code>java.awt.dnd.InvalidDnDOperationException</code> @@ -311,20 +314,23 @@ } /** * Start a drag, given the <code>DragGestureEvent</code> * that initiated the drag, the initial * <code>Cursor</code> to use, * the <code>Transferable</code> subject data * of the drag, the <code>DragSourceListener</code>, * and the <code>FlavorMap</code>. * <P> + * Note, that if {@code Cursor} is specified, i.e. drag cursor parameter + * is not a {@code null}, it should be set as a current drag cursor + * and default cursor handling would be disabled for the drag operation. * @param trigger the <code>DragGestureEvent</code> that * initiated the drag * @param dragCursor the initial <code>Cursor</code> or * <code>null</code> for defaults * @param transferable the subject data of the drag * @param dsl the <code>DragSourceListener</code> * @param flavorMap the <code>FlavorMap</code> to use or <code>null</code> * <P> * @throws <code>java.awt.dnd.InvalidDnDOperationException</code> * if the Drag and Drop @@ -345,20 +351,23 @@ * Start a drag, given the <code>DragGestureEvent</code> * that initiated the drag, the initial <code>Cursor</code> * to use, * the <code>Image</code> to drag, * the offset of the <code>Image</code> origin * from the hotspot of the <code>Cursor</code> * at the instant of the trigger, * the subject data of the drag, and * the <code>DragSourceListener</code>. * <P> + * Note, that if {@code Cursor} is specified, i.e. drag cursor parameter + * is not a {@code null}, it should be set as a current drag cursor + * and default cursor handling would be disabled for the drag operation. * @param trigger the <code>DragGestureEvent</code> that initiated the drag * @param dragCursor the initial <code>Cursor</code> or <code>null</code> for defaults * @param dragImage the <code>Image</code> to drag or <code>null</code> * @param dragOffset the offset of the <code>Image</code> origin from the hotspot * of the <code>Cursor</code> at the instant of the trigger * @param transferable the subject data of the drag * @param dsl the <code>DragSourceListener</code> * <P> * @throws <code>java.awt.dnd.InvalidDnDOperationException</code> * if the Drag and Drop @@ -377,20 +386,23 @@ } /** * Start a drag, given the <code>DragGestureEvent</code> * that initiated the drag, the initial * <code>Cursor</code> to * use, * the <code>Transferable</code> subject data * of the drag, and the <code>DragSourceListener</code>. * <P> + * Note, that if {@code Cursor} is specified, i.e. drag cursor parameter + * is not a {@code null}, it should be set as a current drag cursor + * and default cursor handling would be disabled for the drag operation. * @param trigger the <code>DragGestureEvent</code> that initiated the drag * @param dragCursor the initial <code>Cursor</code> or <code>null</code> for defaults * @param transferable the subject data of the drag * @param dsl the <code>DragSourceListener</code> * <P> * @throws <code>java.awt.dnd.InvalidDnDOperationException</code> * if the Drag and Drop * system is unable to initiate a drag operation, or if the user * attempts to start a drag while an existing drag operation * is still executing @@ -414,20 +426,23 @@ * to represent the drag over feedback for this drag operation, but * <code>NullPointerException</code> is not thrown. * <p> * If <code>dsl</code> is <code>null</code>, no drag source listener * is registered with the created <code>DragSourceContext</code>, * but <code>NullPointerException</code> is not thrown. * <p> * If <code>dragCursor</code> is <code>null</code>, the default drag * cursors are used for this drag operation. * <code>NullPointerException</code> is not thrown. + * Note, that if {@code Cursor} is specified, i.e. drag cursor parameter + * is not a {@code null}, it should be set as a current drag cursor + * and default cursor handling would be disabled for the drag operation. * * @param dscp The <code>DragSourceContextPeer</code> for this drag * @param dgl The <code>DragGestureEvent</code> that triggered the * drag * @param dragCursor The initial <code>Cursor</code> to display * @param dragImage The <code>Image</code> to drag or <code>null</code> * @param imageOffset The offset of the <code>Image</code> origin from the * hotspot of the cursor at the instant of the trigger * @param t The subject data of the drag * @param dsl The <code>DragSourceListener</code>
10-09-2006

EVALUATION ###@###.### 2004-09-16
16-09-2004