wt.clients.dndMicroApplet
Class SimpleDragGestureRecognizer

java.lang.Object
  extended byjava.awt.dnd.DragGestureRecognizer
      extended byjava.awt.dnd.MouseDragGestureRecognizer
          extended bywt.clients.dndMicroApplet.SimpleDragGestureRecognizer
All Implemented Interfaces:
EventListener, MouseListener, MouseMotionListener, Serializable

final class SimpleDragGestureRecognizer
extends MouseDragGestureRecognizer

Extends MouseDragGestureRecognizer to make it more responsive to mouse drags. Default implementations require the mouse to be moved by at least 5 pixels, but this often fails for small Java applets and quick drag motions. We thus recognize any and all drags instead.

Note that this class signals drag source support for all standard drag actions (move, copy, and link) and selects the starting action based on the Windows modifiers keys on all platforms.


Field Summary
private static int MODIFIER_MASK
          Bitmask union of shift and control modifiers
 
Fields inherited from class java.awt.dnd.MouseDragGestureRecognizer
 
Fields inherited from class java.awt.dnd.DragGestureRecognizer
component, dragGestureListener, dragSource, events, sourceActions
 
Constructor Summary
private SimpleDragGestureRecognizer(DragSource dragSource, Component component, DragGestureListener listener)
          Private constructor which allows all drag actions
 
Method Summary
private  int getDragOperationFromModifiers(MouseEvent e)
          Determine initial drag action from event modifiers.
 void mouseDragged(MouseEvent e)
          If the event list was started and not cleared, then a drag gesture is recognized (regardless of the amount of mouse motion involved).
 void mouseEntered(MouseEvent e)
          No further possibility of drag gesture in progress -- clear event list.
 void mouseExited(MouseEvent e)
          No further possibility of drag gesture in progress -- clear event list.
 void mousePressed(MouseEvent e)
          Restarts drag gesture event list as this is a potential trigger event.
 void mouseReleased(MouseEvent e)
          No further possibility of drag gesture in progress -- clear event list.
(package private) static void register(Component component, DragGestureListener listener)
          Constructs an instance of this class with the given component and listener.
 
Methods inherited from class java.awt.dnd.MouseDragGestureRecognizer
mouseClicked, mouseMoved, registerListeners, unregisterListeners
 
Methods inherited from class java.awt.dnd.DragGestureRecognizer
addDragGestureListener, appendEvent, fireDragGestureRecognized, getComponent, getDragSource, getSourceActions, getTriggerEvent, removeDragGestureListener, resetRecognizer, setComponent, setSourceActions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MODIFIER_MASK

private static final int MODIFIER_MASK
Bitmask union of shift and control modifiers

See Also:
Constant Field Values
Constructor Detail

SimpleDragGestureRecognizer

private SimpleDragGestureRecognizer(DragSource dragSource,
                                    Component component,
                                    DragGestureListener listener)
Private constructor which allows all drag actions

Method Detail

register

static void register(Component component,
                     DragGestureListener listener)
Constructs an instance of this class with the given component and listener. This registers this recognizer with the given component and the listener with the recognizer.


mousePressed

public void mousePressed(MouseEvent e)
Restarts drag gesture event list as this is a potential trigger event. Ignores pop-up menu trigger events.


mouseReleased

public void mouseReleased(MouseEvent e)
No further possibility of drag gesture in progress -- clear event list.


mouseEntered

public void mouseEntered(MouseEvent e)
No further possibility of drag gesture in progress -- clear event list.


mouseExited

public void mouseExited(MouseEvent e)
No further possibility of drag gesture in progress -- clear event list.


mouseDragged

public void mouseDragged(MouseEvent e)
If the event list was started and not cleared, then a drag gesture is recognized (regardless of the amount of mouse motion involved).


getDragOperationFromModifiers

private int getDragOperationFromModifiers(MouseEvent e)
Determine initial drag action from event modifiers. Note that this determination is based on that done on the Windows platform, but is a bit more forgiving (as Windows will not recognize a shift-drag as a drag gesture).