-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
None
-
1.2.0
-
sparc
-
solaris_2.5
Name: sdC67446 Date: 05/28/98
ctor java.awt.dnd.DropTargetDropEvent(DropTargetContext dsc, Point p,
int dropActions,int srcActions,
boolean isLocalT)
swap parameters 'dropActions' and 'srcActions'.
The doc says:
--------------------------------------------------
public DropTargetDropEvent(DropTargetContext dtc,
Point cursorLocn,
int dropAction,
int srcActions,
boolean isLocal)
Construct a DropTargetEvent
Parameters:
dtc - The DropTargetContext for this operation
cursorLocn - The location of the "Drag" Cursors hotspot in Component coordinates
dropAction - The currently selected user drop action
srcActions - The current set of actions supported by the source
isLocalTx - True iff the source is in the same JVM as the target
Here is the test demostrating the bug:
--------------------------------------------------
import java.awt.*;
import java.awt.dnd.*;
public class Test extends DropTarget {
public Test() {
super(new Button(),null);
}
public DropTargetContext createDropTargetContext() {
return super.createDropTargetContext();
}
public static void main(String[] args) {
Test test = new Test();
DropTargetContext dtc = test.createDropTargetContext();
DropTargetDropEvent dtde =
new DropTargetDropEvent(dtc,
new Point(0,0),
DnDConstants.ACTION_COPY,
DnDConstants.ACTION_MOVE,
false);
if ((dtde.getDropAction() != DnDConstants.ACTION_COPY) &&
(dtde.getDropAction() == DnDConstants.ACTION_MOVE)) {
// should: dtde.getDropAction() == DnDConstants.ACTION_COPY
System.out.println("getDropAction() swapped.");
}
if ((dtde.getSourceActions() != DnDConstants.ACTION_MOVE) &&
(dtde.getSourceActions() == DnDConstants.ACTION_COPY)) {
// should: dtde.getSourceActions() == DnDConstants.ACTION_MOVE
System.out.println("getSourceActions() swapped.");
}
}
}
Here is test's output:
--------------------------------------------------
getDropAction() swapped.
getSourceActions() swapped.
--------------------------------------------------
======================================================================