Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.jempeg.empeg.emplode.action
Class AbstractDragListener  view AbstractDragListener download AbstractDragListener.java

java.lang.Object
  extended byorg.jempeg.empeg.emplode.action.AbstractDragListener
All Implemented Interfaces:
java.util.EventListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener
Direct Known Subclasses:
TableDragListener, TreeDragListener

public abstract class AbstractDragListener
extends java.lang.Object
implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener

AbstractDragListener implements simple drag-and-drop support for components. This handles autoscrolling. If only we could use J2SE for "real" dnd :(

Version:
$Revision: 1.5 $

Field Summary
private static int DRAG_THRESHOLD
           
private  boolean myCanDragOutside
           
private  boolean myDragging
           
private  javax.swing.JLabel myDragLabel
           
private  java.awt.Rectangle myDragRectangle
           
private  java.lang.Object myDragSource
           
private  java.lang.Object myDropTarget
           
private  javax.swing.JFrame myFrame
           
private  java.awt.Point myStartingPoint
           
 
Constructor Summary
AbstractDragListener(javax.swing.JFrame _frame)
           
 
Method Summary
protected abstract  void drop(java.lang.Object _dragSource, java.lang.Object _dropTarget)
           
protected  java.lang.Object getDragSource()
           
protected abstract  java.lang.Object getDragSource(java.awt.event.MouseEvent _event)
           
protected abstract  java.lang.String getDragTitle()
           
protected  java.lang.Object getDropTarget()
           
protected abstract  java.lang.Object getDropTarget(java.awt.event.MouseEvent _event)
           
 void mouseClicked(java.awt.event.MouseEvent _event)
          This method is called when the mouse is clicked (pressed and released in short succession) on a component.
 void mouseDragged(java.awt.event.MouseEvent _event)
          This method is called when the mouse is moved over a component while a button has been pressed.
 void mouseEntered(java.awt.event.MouseEvent _event)
          This method is called when the mouse enters a component.
 void mouseExited(java.awt.event.MouseEvent _event)
          This method is called when the mouse exits a component.
 void mouseMoved(java.awt.event.MouseEvent _event)
          This method is called when the mouse is moved over a component while no button is pressed.
 void mousePressed(java.awt.event.MouseEvent _event)
          This method is called when the mouse is pressed over a component.
 void mouseReleased(java.awt.event.MouseEvent _event)
          This method is called when the mouse is released over a component.
protected  void removeDragLabel()
           
protected  void setCanDragOutside(boolean _canDragOutside)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DRAG_THRESHOLD

private static final int DRAG_THRESHOLD
See Also:
Constant Field Values

myFrame

private javax.swing.JFrame myFrame

myDragLabel

private javax.swing.JLabel myDragLabel

myDragSource

private java.lang.Object myDragSource

myDropTarget

private java.lang.Object myDropTarget

myDragRectangle

private java.awt.Rectangle myDragRectangle

myCanDragOutside

private boolean myCanDragOutside

myDragging

private boolean myDragging

myStartingPoint

private java.awt.Point myStartingPoint
Constructor Detail

AbstractDragListener

public AbstractDragListener(javax.swing.JFrame _frame)
Method Detail

getDragSource

protected abstract java.lang.Object getDragSource(java.awt.event.MouseEvent _event)

getDropTarget

protected abstract java.lang.Object getDropTarget(java.awt.event.MouseEvent _event)

getDragTitle

protected abstract java.lang.String getDragTitle()

drop

protected abstract void drop(java.lang.Object _dragSource,
                             java.lang.Object _dropTarget)

getDragSource

protected java.lang.Object getDragSource()

getDropTarget

protected java.lang.Object getDropTarget()

setCanDragOutside

protected void setCanDragOutside(boolean _canDragOutside)

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent _event)
Description copied from interface: java.awt.event.MouseMotionListener
This method is called when the mouse is moved over a component while no button is pressed.

Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent _event)
Description copied from interface: java.awt.event.MouseMotionListener
This method is called when the mouse is moved over a component while a button has been pressed.

Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener

removeDragLabel

protected void removeDragLabel()

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent _event)
Description copied from interface: java.awt.event.MouseListener
This method is called when the mouse is clicked (pressed and released in short succession) on a component.

Specified by:
mouseClicked in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent _event)
Description copied from interface: java.awt.event.MouseListener
This method is called when the mouse is pressed over a component.

Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent _event)
Description copied from interface: java.awt.event.MouseListener
This method is called when the mouse is released over a component.

Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent _event)
Description copied from interface: java.awt.event.MouseListener
This method is called when the mouse enters a component.

Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent _event)
Description copied from interface: java.awt.event.MouseListener
This method is called when the mouse exits a component.

Specified by:
mouseExited in interface java.awt.event.MouseListener