summaryrefslogtreecommitdiff
path: root/java/awt/dnd/DragSource.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/awt/dnd/DragSource.java')
-rw-r--r--java/awt/dnd/DragSource.java25
1 files changed, 23 insertions, 2 deletions
diff --git a/java/awt/dnd/DragSource.java b/java/awt/dnd/DragSource.java
index 13ffc9615..05eb6709d 100644
--- a/java/awt/dnd/DragSource.java
+++ b/java/awt/dnd/DragSource.java
@@ -90,7 +90,7 @@ public class DragSource implements Serializable
*/
public static DragSource getDefaultDragSource()
{
- return null;
+ return new DragSource();
}
public static boolean isDragImageSupported()
@@ -172,13 +172,34 @@ public class DragSource implements Serializable
return flavorMap;
}
+ /**
+ * Dummy DragGestureRecognizer when Toolkit doesn't support drag and drop.
+ */
+ static class NoDragGestureRecognizer extends DragGestureRecognizer
+ {
+ NoDragGestureRecognizer(DragSource ds, Component c, int actions,
+ DragGestureListener dgl)
+ {
+ super(ds, c, actions, dgl);
+ }
+
+ protected void registerListeners() { }
+ protected void unregisterListeners() { }
+ }
+
public DragGestureRecognizer
createDragGestureRecognizer(Class recognizer, Component c, int actions,
DragGestureListener dgl)
{
- return Toolkit.getDefaultToolkit ()
+ DragGestureRecognizer dgr;
+ dgr = Toolkit.getDefaultToolkit ()
.createDragGestureRecognizer (recognizer, this, c, actions,
dgl);
+
+ if (dgr == null)
+ dgr = new NoDragGestureRecognizer(this, c, actions, dgl);
+
+ return dgr;
}
public DragGestureRecognizer