-
Bug
-
Resolution: Fixed
-
P4
-
1.2.0
-
1.2.2
-
sparc
-
solaris_2.5
Name: sdC67446 Date: 11/02/98
The specification for
java.awt.dnd.DragSource.createDragGestureRecognizer(
Class recognizerAbstractClass,
Component c,
int actions,
DragGestureListener dgl)
doesn't specify when the method returns null;
Currently method returns not null
iff 'recognizerAbstractClass' == MouseDragGestureRecognizer.class.
The method's behaviour if 'c' == null, 'recognizerAbstractClass' ==
null or 'dgl' == null, or if 'actions' contains invalid value is also
unclear.
Currently method ignores null input values and produces binary AND for
'actions' with (DnDConstants.ACTION_COPY_OR_MOVE |
DnDConstants.ACTION_REFERENCE) constant.
The method createDefaultDragGestureRecognizer(Component c,
int actions,
DragGestureListener dgl)
has the same problem.
The doc says:
-------------------------------------------------------------
public DragGestureRecognizer
createDragGestureRecognizer(Class recognizerAbstractClass,
Component c,
int actions,
DragGestureListener dgl)
Creates a new DragSourceRecognizer that implements the
specified abstract subclass of DragGestureRecognizer,
and sets the specified Component and DragGestureListener
on the newly created object.
Parameters:
recognizerAbstractClass - The requested abstract type
actions - The permitted source drag actions
c - The Component target
dgl - The DragGestureListener to notify
Returns:
the new DragGestureRecognizer or null
The test demonstrating the bug:
------------------------------------------------------------
import java.awt.dnd.*;
import java.awt.*;
public class Test {
public static void main(String[] args) {
DragSource ds = new DragSource();
DragGestureListener dgl = new DragGestureListener() {
public void dragGestureRecognized(DragGestureEvent dge) {}
};
DragGestureRecognizer dgr =
ds.createDragGestureRecognizer(MouseDragGestureRecognizer.class,
null,
-1,
null);
System.out.println("1."+dgr);
if (dgr.getSourceActions() == (DnDConstants.ACTION_COPY_OR_MOVE |
DnDConstants.ACTION_REFERENCE)) {
System.out.println("getSourceActions() == ACTION_COPY_OR_MOVE | ACTION_REFERENCE");
}
dgr =
ds.createDragGestureRecognizer(Integer.class,
new Button(),
DnDConstants.ACTION_COPY,
dgl);
System.out.println("2."+dgr);
}
}
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.sun.awt.motif.MMouseDragGestureRecognizer@ad7a35b8
getSourceActions() == ACTION_COPY_OR_MOVE | ACTION_REFERENCE
2.null
------------------------------------------------------------
======================================================================