dsto.dfc.swing.dnd
Class DfcMouseDragGestureRecognizer

java.lang.Object
  extended by java.awt.dnd.DragGestureRecognizer
      extended by java.awt.dnd.MouseDragGestureRecognizer
          extended by dsto.dfc.swing.dnd.DfcMouseDragGestureRecognizer
All Implemented Interfaces:
MouseListener, MouseMotionListener, Serializable, EventListener

public class DfcMouseDragGestureRecognizer
extends MouseDragGestureRecognizer

A simple mouse-based drag gesture recogniser that only triggers drag and drop actions on MOUSE_DRAGGED events. This can be used to work around a problem with the mouse gesture recognisers in JDK 1.2.2 and 1.3 that get confused in the case of a MOUSE_DOWN/MOUSE_EXIT (ie case where MOUSE_UP is not seen after a MOUSE_DOWN). This happens, for example, when a JTable pops up an inline editor component (eg a checkbox) in response to a mouse down event.

Version:
$Revision$
See Also:
Serialized Form

Field Summary
protected  boolean dragging
           
protected  MouseEvent lastPress
           
 
Fields inherited from class java.awt.dnd.DragGestureRecognizer
component, dragGestureListener, dragSource, events, sourceActions
 
Constructor Summary
DfcMouseDragGestureRecognizer(Component component, int action)
           
DfcMouseDragGestureRecognizer(DragSource dragSource, Component component, int action)
           
DfcMouseDragGestureRecognizer(DragSource dragSource, Component component, int action, DragGestureListener dgListener)
           
 
Method Summary
protected static int distance(Point p1, Point p2)
           
 void mouseDragged(MouseEvent e)
           
 void mousePressed(MouseEvent e)
           
 void mouseReleased(MouseEvent e)
           
 void resetRecognizer()
           
 
Methods inherited from class java.awt.dnd.MouseDragGestureRecognizer
mouseClicked, mouseEntered, mouseExited, mouseMoved, registerListeners, unregisterListeners
 
Methods inherited from class java.awt.dnd.DragGestureRecognizer
addDragGestureListener, appendEvent, fireDragGestureRecognized, getComponent, getDragSource, getSourceActions, getTriggerEvent, removeDragGestureListener, setComponent, setSourceActions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lastPress

protected MouseEvent lastPress

dragging

protected boolean dragging
Constructor Detail

DfcMouseDragGestureRecognizer

public DfcMouseDragGestureRecognizer(Component component,
                                     int action)

DfcMouseDragGestureRecognizer

public DfcMouseDragGestureRecognizer(DragSource dragSource,
                                     Component component,
                                     int action)

DfcMouseDragGestureRecognizer

public DfcMouseDragGestureRecognizer(DragSource dragSource,
                                     Component component,
                                     int action,
                                     DragGestureListener dgListener)
Method Detail

mousePressed

public void mousePressed(MouseEvent e)
Specified by:
mousePressed in interface MouseListener
Overrides:
mousePressed in class MouseDragGestureRecognizer

mouseReleased

public void mouseReleased(MouseEvent e)
Specified by:
mouseReleased in interface MouseListener
Overrides:
mouseReleased in class MouseDragGestureRecognizer

mouseDragged

public void mouseDragged(MouseEvent e)
Specified by:
mouseDragged in interface MouseMotionListener
Overrides:
mouseDragged in class MouseDragGestureRecognizer

resetRecognizer

public void resetRecognizer()
Overrides:
resetRecognizer in class DragGestureRecognizer

distance

protected static final int distance(Point p1,
                                    Point p2)


Copyright © 2008 Commonwealth of Australia