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.java32
1 files changed, 24 insertions, 8 deletions
diff --git a/java/awt/dnd/DragSource.java b/java/awt/dnd/DragSource.java
index 57b4fac12..f57749559 100644
--- a/java/awt/dnd/DragSource.java
+++ b/java/awt/dnd/DragSource.java
@@ -51,7 +51,6 @@ import java.awt.datatransfer.FlavorMap;
import java.awt.datatransfer.SystemFlavorMap;
import java.awt.datatransfer.Transferable;
import java.awt.dnd.peer.DragSourceContextPeer;
-import java.awt.event.MouseMotionListener;
import java.io.Serializable;
import java.util.EventListener;
@@ -77,6 +76,8 @@ public class DragSource implements Serializable
private transient DragSourceMotionListener dragSourceMotionListener;
private static DragSource ds;
+ private DragSourceContextPeer peer;
+ private DragSourceContext context;
/**
* Initializes the drag source.
@@ -104,16 +105,15 @@ public class DragSource implements Serializable
ds = null;
throw new HeadlessException();
}
-
+
if (ds == null)
ds = new DragSource();
return ds;
}
public static boolean isDragImageSupported()
- throws NotImplementedException
{
- // FIXME: Implement this
+ // In all cases, Sun returns false here.
return false;
}
@@ -139,13 +139,16 @@ public class DragSource implements Serializable
// This function sends the same message to the context, which then forwards
// it to the peer, passing itself as a parameter. Now, the native system has
// access to the Transferable through the context.
-
+
try
{
flavorMap = map;
- DragSourceContextPeer peer = Toolkit.getDefaultToolkit().
- createDragSourceContextPeer(trigger);
- DragSourceContext context = createDragSourceContext(peer, trigger,
+
+ if (peer == null)
+ peer = Toolkit.getDefaultToolkit().createDragSourceContextPeer(trigger);
+
+ if (context == null)
+ context = createDragSourceContext(peer, trigger,
dragCursor,
dragImage,
imageOffset, trans,
@@ -306,4 +309,17 @@ public class DragSource implements Serializable
// Return an empty EventListener array.
return new EventListener [0];
}
+
+ /**
+ * TODO
+ * @return TODO
+ *
+ * @since 1.5
+ */
+ public static int getDragThreshold()
+ throws NotImplementedException
+ {
+ // FIXME: Not implemented.
+ return 8;
+ }
} // class DragSource