DragGestureRecognizer is an
abstract base class for the specification
of a platform-dependent listener that can be associated with a particular
Component in order to
identify platform-dependent drag initiating gestures.
The appropriate DragGestureRecognizer
subclass instance is obtained from the
DragSource associated with
a particular Component, or from the Toolkit object via its
createDragGestureRecognizer()
method.
Once the DragGestureRecognizer
is associated with a particular Component
it will register the appropriate listener interfaces on that
Component
in order to track the input events delivered to the Component.
Once the DragGestureRecognizer identifies a sequence of events
on the Component as a drag initiating gesture, it will notify
its unicast DragGestureListener by
invoking its
gestureRecognized()
method.
When a concrete DragGestureRecognizer
instance detects a drag initiating
gesture on the Component it is associated with,
it fires a DragGestureEvent to
the DragGestureListener registered on
its unicast event source for DragGestureListener
events. This DragGestureListener is responsible
for causing the associated
DragSource to start the Drag and Drop operation (if
appropriate).
java.awt.dnd.DragGestureListener , java.awt.dnd.DragGestureEvent , java.awt.dnd.DragSource
| Modifier and Type | Field and Description |
|---|---|
| protected Component | component
The |
| protected transient DragGestureListener | dragGestureListener
The |
| protected DragSource | dragSource
The |
| protected ArrayList | events
The list of events (in order) that
the |
| private static final long | serialVersionUID
Use serialVersionUID from JDK 1.4 for interoperability. |
| protected int | sourceActions
An |
| Access | Constructor and Description |
|---|---|
| protected | DragGestureRecognizer(DragSource
the ds, Component DragSource this
DragGestureRecognizer
will use to process the Drag and Drop operationthe c, int Component
this DragGestureRecognizer
should "observe" the event stream to,
in order to detect a drag initiating gesture.
If this value is null, the
DragGestureRecognizer
is not associated with any Component.the set (logical OR) of the
sa, DragGestureListener DnDConstants
that this Drag and Drop operation will supportthe dgl)DragGestureRecognizer
to notify when a drag gesture is detectedConstruct a new |
| protected | DragGestureRecognizer(DragSource
the ds, Component DragSource this
DragGestureRecognizer will use to
process the Drag and Drop operationthe c, int Component this
DragGestureRecognizer should "observe" the event
stream to, in order to detect a drag initiating gesture.
If this value is null, the
DragGestureRecognizer
is not associated with any Component.the set (logical OR) of the sa)DnDConstants
that this Drag and Drop operation will supportConstruct a new |
| protected | DragGestureRecognizer(DragSource
the ds, Component DragSource this
DragGestureRecognizer
will use to process the Drag and Drop operationthe c)Component
this DragGestureRecognizer
should "observe" the event stream to,
in order to detect a drag initiating gesture.
If this value is null,
the DragGestureRecognizer
is not associated with any Component.Construct a new |
| protected | DragGestureRecognizer(DragSource
the ds)DragSource this
DragGestureRecognizer will
use to process the Drag and Drop operationConstruct a new |
| Modifier and Type | Method and Description |
|---|---|
| public synchronized void | addDragGestureListener(DragGestureListener
the dgl)DragGestureListener to register
with this DragGestureRecognizer.Register a new |
| protected synchronized void | appendEvent(InputEvent
the awtie)InputEvent
to add to this DragGestureRecognizer's
internal array of events. Note that null
is not a valid value, and will be ignored.Listeners registered on the Component by this Recognizer shall record all Events that are recognized as part of the series of Events that go to comprise a Drag and Drop initiating gesture via this API. |
| protected synchronized void | fireDragGestureRecognized(int
The action initially selected by the users gesture dragAction, Point The point (in Component coords) where the gesture originated p)Notify the DragGestureListener that a Drag and Drop initiating gesture has occurred. |
| public synchronized Component | Returns: The Component this DragGestureRecognizer is associated withThis method returns the |
| public DragSource | Returns: the DragSourceThis method returns the |
| public synchronized int | Returns: the currently permitted source action(s)This method returns an int representing the type of action(s) this Drag and Drop operation will support. |
| public InputEvent | Returns: the initial event that triggered the drag gestureThis method returns the first event in the series of events that initiated the Drag and Drop operation. |
| private void | readObject(ObjectInputStream
the s)ObjectInputStream to readDeserializes this |
| protected abstract void | registerListeners()
register this DragGestureRecognizer's Listeners with the Component subclasses must override this method |
| public synchronized void | removeDragGestureListener(DragGestureListener
the dgl)DragGestureListener to unregister
from this DragGestureRecognizerunregister the current DragGestureListener |
| public void | |
| public synchronized void | setComponent(Component
The c)Component or nullset the Component that the DragGestureRecognizer is associated with registerListeners() and unregisterListeners() are called as a side effect as appropriate. |
| public synchronized void | setSourceActions(int
the permitted source drag action(s) actions)This method sets the permitted source drag action(s) for this Drag and Drop operation. |
| protected abstract void | unregisterListeners()
unregister this DragGestureRecognizer's Listeners with the Component subclasses must override this method |
| private void | writeObject(ObjectOutputStream
the s)ObjectOutputStream to writeSerializes this |
| component | back to summary |
|---|---|
| protected Component component The | |
| dragGestureListener | back to summary |
|---|---|
| protected transient DragGestureListener dragGestureListener The | |
| dragSource | back to summary |
|---|---|
| protected DragSource dragSource The | |
| events | back to summary |
|---|---|
| protected ArrayList<InputEvent> events The list of events (in order) that
the | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Use serialVersionUID from JDK 1.4 for interoperability. | |
| sourceActions | back to summary |
|---|---|
| protected int sourceActions An | |
| DragGestureRecognizer | back to summary |
|---|---|
| protected DragGestureRecognizer(DragSource ds, Component c, int sa, DragGestureListener dgl) Construct a new
| |
| DragGestureRecognizer | back to summary |
|---|---|
| protected DragGestureRecognizer(DragSource ds, Component c, int sa) Construct a new
| |
| DragGestureRecognizer | back to summary |
|---|---|
| protected DragGestureRecognizer(DragSource ds, Component c) Construct a new
| |
| DragGestureRecognizer | back to summary |
|---|---|
| protected DragGestureRecognizer(DragSource ds) Construct a new
| |
| addDragGestureListener | back to summary |
|---|---|
| public synchronized void addDragGestureListener(DragGestureListener dgl) throws TooManyListenersException Register a new
| |
| appendEvent | back to summary |
|---|---|
| protected synchronized void appendEvent(InputEvent awtie) Listeners registered on the Component by this Recognizer shall record all Events that are recognized as part of the series of Events that go to comprise a Drag and Drop initiating gesture via this API.
This method is used by a
| |
| fireDragGestureRecognized | back to summary |
|---|---|
| protected synchronized void fireDragGestureRecognized(int dragAction, Point p) Notify the DragGestureListener that a Drag and Drop initiating gesture has occurred. Then reset the state of the Recognizer.
| |
| getComponent | back to summary |
|---|---|
| public synchronized Component getComponent() This method returns the
| |
| getDragSource | back to summary |
|---|---|
| public DragSource getDragSource() This method returns the
| |
| getSourceActions | back to summary |
|---|---|
| public synchronized int getSourceActions() This method returns an int representing the type of action(s) this Drag and Drop operation will support.
| |
| getTriggerEvent | back to summary |
|---|---|
| public InputEvent getTriggerEvent() This method returns the first event in the series of events that initiated the Drag and Drop operation.
| |
| readObject | back to summary |
|---|---|
| private void readObject(ObjectInputStream s) throws ClassNotFoundException, IOException Deserializes this
| |
| registerListeners | back to summary |
|---|---|
| protected abstract void registerListeners() register this DragGestureRecognizer's Listeners with the Component subclasses must override this method | |
| removeDragGestureListener | back to summary |
|---|---|
| public synchronized void removeDragGestureListener(DragGestureListener dgl) unregister the current DragGestureListener
| |
| resetRecognizer | back to summary |
|---|---|
| public void resetRecognizer() Reset the Recognizer, if its currently recognizing a gesture, ignore it. | |
| setComponent | back to summary |
|---|---|
| public synchronized void setComponent(Component c) set the Component that the DragGestureRecognizer is associated with registerListeners() and unregisterListeners() are called as a side effect as appropriate.
| |
| setSourceActions | back to summary |
|---|---|
| public synchronized void setSourceActions(int actions) This method sets the permitted source drag action(s) for this Drag and Drop operation.
| |
| unregisterListeners | back to summary |
|---|---|
| protected abstract void unregisterListeners() unregister this DragGestureRecognizer's Listeners with the Component subclasses must override this method | |
| writeObject | back to summary |
|---|---|
| private void writeObject(ObjectOutputStream s) throws IOException Serializes this
| |