java.awt.dnd
Class DropTarget

java.lang.Object
  extended by java.awt.dnd.DropTarget
All Implemented Interfaces:
DropTargetListener, Serializable, EventListener

public class DropTarget
extends Object
implements DropTargetListener, EventListener, Serializable

Since:
1.2
See Also:
Serialized Form

Nested Class Summary
protected static class DropTarget.DropTargetAutoScroller
           
 
Constructor Summary
DropTarget()
          Creates a DropTarget object.
DropTarget(Component c, DropTargetListener dtl)
          Creates a DropTarget object.
DropTarget(Component c, int i, DropTargetListener dtl)
          Creates a DropTarget object.
DropTarget(Component c, int i, DropTargetListener dtl, boolean b)
          Creates a DropTarget object.
DropTarget(Component c, int i, DropTargetListener dtl, boolean b, FlavorMap fm)
          Creates a DropTarget object.
 
Method Summary
 void addDropTargetListener(DropTargetListener dtl)
          Adds a new DropTargetListener.
 void addNotify(ComponentPeer p)
           
protected  void clearAutoscroll()
           
protected  DropTarget.DropTargetAutoScroller createDropTargetAutoScroller(Component c, Point p)
           
protected  DropTargetContext createDropTargetContext()
           
 void dragEnter(DropTargetDragEvent dtde)
          Called when the cursor hotspot enters a drop site which will accept the drag.
 void dragExit(DropTargetEvent dte)
          Called when the cursor hotspot moves outside of a drop site which will accept the drag.
 void dragOver(DropTargetDragEvent dtde)
          Called when the cursor hotspot moves inside of a drop site which will accept the drag.
 void drop(DropTargetDropEvent dtde)
          Called when the drag operation has terminated with a drop.
 void dropActionChanged(DropTargetDragEvent dtde)
          Called when the user modifies the drop gesture.
 Component getComponent()
          Returns the component associated with this drop target object.
 int getDefaultActions()
          Returns the default actions.
 DropTargetContext getDropTargetContext()
           
 FlavorMap getFlavorMap()
           
protected  void initializeAutoscrolling(Point p)
           
 boolean isActive()
           
 void removeDropTargetListener(DropTargetListener dtl)
           
 void removeNotify(ComponentPeer p)
           
 void setActive(boolean active)
           
 void setComponent(Component c)
          Sets the component associated with this drop target object.
 void setDefaultActions(int ops)
          Sets the default actions.
 void setFlavorMap(FlavorMap fm)
           
protected  void updateAutoscroll(Point dragCursorLocn)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DropTarget

public DropTarget()
Creates a DropTarget object.

Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() returns true.

DropTarget

public DropTarget(Component c,
                  DropTargetListener dtl)
Creates a DropTarget object.

Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() returns true.

DropTarget

public DropTarget(Component c,
                  int i,
                  DropTargetListener dtl)
Creates a DropTarget object.

Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() returns true.

DropTarget

public DropTarget(Component c,
                  int i,
                  DropTargetListener dtl,
                  boolean b)
Creates a DropTarget object.

Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() returns true.

DropTarget

public DropTarget(Component c,
                  int i,
                  DropTargetListener dtl,
                  boolean b,
                  FlavorMap fm)
Creates a DropTarget object.

Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() returns true.
Method Detail

setComponent

public void setComponent(Component c)
Sets the component associated with this drop target object.


getComponent

public Component getComponent()
Returns the component associated with this drop target object.


setDefaultActions

public void setDefaultActions(int ops)
Sets the default actions.


getDefaultActions

public int getDefaultActions()
Returns the default actions.


setActive

public void setActive(boolean active)

isActive

public boolean isActive()

addDropTargetListener

public void addDropTargetListener(DropTargetListener dtl)
                           throws TooManyListenersException
Adds a new DropTargetListener.

Throws:
TooManyListenersException - Sun's JDK does not, despite documentation, throw this exception here when you install an additional DropTargetListener. So to be compatible, we do the same thing.

removeDropTargetListener

public void removeDropTargetListener(DropTargetListener dtl)

dragEnter

public void dragEnter(DropTargetDragEvent dtde)
Description copied from interface: DropTargetListener
Called when the cursor hotspot enters a drop site which will accept the drag.

Specified by:
dragEnter in interface DropTargetListener
Parameters:
dtde - the drag source drag event

dragOver

public void dragOver(DropTargetDragEvent dtde)
Description copied from interface: DropTargetListener
Called when the cursor hotspot moves inside of a drop site which will accept the drag.

Specified by:
dragOver in interface DropTargetListener
Parameters:
dtde - the drag source drag event

dropActionChanged

public void dropActionChanged(DropTargetDragEvent dtde)
Description copied from interface: DropTargetListener
Called when the user modifies the drop gesture. This is often the case when additional mouse or key events are received during the drag.

Specified by:
dropActionChanged in interface DropTargetListener
Parameters:
dtde - the drag source drag event

dragExit

public void dragExit(DropTargetEvent dte)
Description copied from interface: DropTargetListener
Called when the cursor hotspot moves outside of a drop site which will accept the drag. This could also happen if the drop site is no longer active, or no longer accepts the drag.

Specified by:
dragExit in interface DropTargetListener
Parameters:
dte - the drag source drag event

drop

public void drop(DropTargetDropEvent dtde)
Description copied from interface: DropTargetListener
Called when the drag operation has terminated with a drop.

Specified by:
drop in interface DropTargetListener
Parameters:
dtde - the drag source drag event

getFlavorMap

public FlavorMap getFlavorMap()

setFlavorMap

public void setFlavorMap(FlavorMap fm)

addNotify

public void addNotify(ComponentPeer p)

removeNotify

public void removeNotify(ComponentPeer p)

getDropTargetContext

public DropTargetContext getDropTargetContext()

createDropTargetContext

protected DropTargetContext createDropTargetContext()

createDropTargetAutoScroller

protected DropTarget.DropTargetAutoScroller createDropTargetAutoScroller(Component c,
                                                                         Point p)

initializeAutoscrolling

protected void initializeAutoscrolling(Point p)

updateAutoscroll

protected void updateAutoscroll(Point dragCursorLocn)

clearAutoscroll

protected void clearAutoscroll()