Name: sdC67446 Date: 11/16/98
spec for constructors
java.awt.dnd.DroptargetDropEvent(DragSourceContext dsc, Point p,
int dropAction, int srcActions)
says nothing about range of valid values for 'dropAction' and 'srcActions'.
Currently constructor accepts:
DnDConstants.ACTION_NONE,DnDConstants.ACTION_COPY,
DnDConstants.ACTION_MOVE,DnDConstants.ACTION_LINK for 'dropAction'
and 'srcActions':
'srcActions' & ~(DnDConstants.ACTION_COPY_OR_MOVE | DnDConstants.ACTION_LINK).
For any other ints constructor throws IllegalArgumentException.
The same problem exists in constructor
java.awt.dnd.DropTargetDropEvent(DragSourceContext dsc, Point p,
int dropAction, int srcActions,
boolean success)
See also bug #4143344.
The doc says:
-------------------------------------------------------------
public DropTargetDropEvent(DropTargetContext dtc,
Point cursorLocn,
int dropAction,
int srcActions)
construct an Event
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
The test demonstrating the bug:
------------------------------------------------------------
mport java.awt.Button;
import java.awt.Point;
public class Test extends DropTarget {
static int goodActions[] = {
DnDConstants.ACTION_NONE,
DnDConstants.ACTION_COPY,
DnDConstants.ACTION_MOVE,
DnDConstants.ACTION_LINK
};
static int badActions[] = {
~DnDConstants.ACTION_NONE,
~DnDConstants.ACTION_COPY,
~DnDConstants.ACTION_MOVE,
~DnDConstants.ACTION_LINK
};
public Test() {
super(new Button(),null);
}
public DropTargetContext createDropTargetContext() {
return super.createDropTargetContext();
}
public static void main(String[] args) {
Test test = new Test();
Point p = new Point(0,0);
DropTargetDropEvent dtde = null;
for (int i=0;i<goodActions.length;i++) {
System.out.println("1.");
dtde = new DropTargetDropEvent(test.createDropTargetContext(),
p,
goodActions[i],
goodActions[0]);
}
for (int i=0;i<badActions.length;i++) {
try {
dtde = new DropTargetDropEvent(test.createDropTargetContext(),
p,
badActions[i],
goodActions[0]);
} catch (Exception e) {
System.out.println("2."+e);
}
}
for (int i=0;i<goodActions.length;i++) {
System.out.println("3.");
dtde = new DropTargetDropEvent(test.createDropTargetContext(),
p,
goodActions[0],
goodActions[i]);
}
for (int i=0;i<badActions.length;i++) {
try {
dtde = new DropTargetDropEvent(test.createDropTargetContext(),
p,
goodActions[0],
badActions[i]);
} catch (Exception e) {
System.out.println("4."+e);
}
}
}
}
Test output:
------------------------------------------------------------
Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
1.
1.
1.
1.
2.java.lang.IllegalArgumentException: dropAction = -1
2.java.lang.IllegalArgumentException: dropAction = -2
2.java.lang.IllegalArgumentException: dropAction = -3
2.java.lang.IllegalArgumentException: dropAction = -1073741825
3.
3.
3.
3.
4.java.lang.IllegalArgumentException: srcActions
4.java.lang.IllegalArgumentException: srcActions
4.java.lang.IllegalArgumentException: srcActions
4.java.lang.IllegalArgumentException: srcActions
------------------------------------------------------------
======================================================================