All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.gloaming.awt.dnd.DragSource

java.lang.Object
   |
   +----com.gloaming.awt.dnd.DragSource

public class DragSource
extends java.lang.Object
Local equivelent to the Java2 DragSource. This class looks for the presence of either the Java2 or the MRJ drag and drop libraries at run-time. If either is present, it will return proxy objects that conform to a sub-set of the Java2 drag and drop API. These objects have the same name and interfaces as the standard Java2 DnD objects, but are defined in the com.jlc.awt.dnd package, rather than the standard java.awt.dnd package.

The design goal is a functional replacement for the Java2 DnD classes that will perform the same function in the presence of the Java2 libraries, perform equivelent functions in the presence of the MRJ 2.2 libraries, or do nothing in the absence of both.

Ultimately, we will drop support for run-time environments prior to Java 1.2. At which time, this package can be disposed of, and all of the application source that uses it can be recompiled simply by changing the import statements from com.jlc.awt.dnd.* to java.awt.dnd.*.

See Also:
java.awt.dnd.DragSource

Constructor Index

 o DragSource()
Creates a new DragSource object.

Method Index

 o createDefaultDragGestureRecognizer(Component, int, DragGestureListener)
Creates a default DragGestureRecognizer attached to the given AWT Component, supporting the given drag actions, that will send dragGestureRecognized event to the given listener.
 o getDefaultDragSource()
Obtain a reference to the default DragSource for this VM.
 o isJava2()
Reports on the presence of the Java2 Drag and Drop classes/library.
 o isMRJ()
Reports on the presence of the MRJ Drag and Drop classes/library.
 o isNULL()
Reports on the absence of both the Java2 and MRJ drag and drop libraries.
 o startDrag(DragGestureEvent, Cursor, Image, Point, Transferable, DragSourceListener)
Begin a drag operation.
 o startDrag(DragGestureEvent, Cursor, Transferable, DragSourceListener)
Begin a drag operation.

Constructors

 o DragSource
 public DragSource()
Creates a new DragSource object. Tries to create a proxy for a real Java2 object. If that failes, it creates an empty DragSource.

Applications would normally create special instances and/or sub-classes of DragSource to define custom MIME translations or DragGestureRecognizers. Since this limited implementation supports none of those capabilities, the need to create your own DragSource is suspect (although harmless).

Methods

 o isJava2
 public static final boolean isJava2()
Reports on the presence of the Java2 Drag and Drop classes/library.

Returns:
true if the Java2 DnD library is present and being used.
 o isMRJ
 public static final boolean isMRJ()
Reports on the presence of the MRJ Drag and Drop classes/library.

Returns:
true if the MRJ DnD library is present and being used.
 o isNULL
 public static final boolean isNULL()
Reports on the absence of both the Java2 and MRJ drag and drop libraries.

Returns:
true if neither the Java2 nor MRJ drag and drop classes are present
 o createDefaultDragGestureRecognizer
 public com.gloaming.awt.dnd.DragGestureRecognizer createDefaultDragGestureRecognizer(java.awt.Component c,
                                                                                      int actions,
                                                                                      com.gloaming.awt.dnd.DragGestureListener ourListener)
Creates a default DragGestureRecognizer attached to the given AWT Component, supporting the given drag actions, that will send dragGestureRecognized event to the given listener.

Parameters:
c - Component to attach the recognizer to
actions - Drag actions supported by this source
ourListener - Listener that will receive the dragGestureRecognized event(s)
Returns:
new DragGestureRecognizer
 o getDefaultDragSource
 public static com.gloaming.awt.dnd.DragSource getDefaultDragSource()
Obtain a reference to the default DragSource for this VM.

Returns:
DragSource
 o startDrag
 public void startDrag(com.gloaming.awt.dnd.DragGestureEvent trigger,
                       java.awt.Cursor dragCursor,
                       java.awt.Image dragImage,
                       java.awt.Point dragOffset,
                       java.awt.datatransfer.Transferable transferable,
                       com.gloaming.awt.dnd.DragSourceListener sourceListener)
Begin a drag operation. This version allows the initial cursor and drag image to be specified.

Parameters:
trigger - DragGestureEventn that initiated this drag operation
dragCursor - Initial Cursor to be used (null==default)
dragImage - Image to be dragged around, instead of an outline of the Component
dragOffset - Offset into image of drag point
transferable - transferable data being dragged
sourceListener - Listener that will receive the source drag events as the drag progresses
 o startDrag
 public void startDrag(com.gloaming.awt.dnd.DragGestureEvent trigger,
                       java.awt.Cursor dragCursor,
                       java.awt.datatransfer.Transferable transferable,
                       com.gloaming.awt.dnd.DragSourceListener sourceListener)
Begin a drag operation.

Parameters:
trigger - DragGestureEventn that initiated this drag operation
dragCursor - Initial Cursor to be used (null==default)
transferable - transferable data being dragged
sourceListener - Listener that will receive the source drag events as the drag progresses

All Packages  Class Hierarchy  This Package  Previous  Next  Index