Java Platform 1.2
Beta 4

java.awt.dnd
Class DropTarget

java.lang.Object
  |
  +--java.awt.dnd.DropTarget

public class DropTarget
extends Object
implements DropTargetListener, Serializable

The DropTarget is associated with a Component, when that Component wishes to accept Drops during Drag and Drop operations.

Since:
JDK1.2
See Also:
Serialized Form

Inner Class Summary
protected static class DropTarget.DropTargetAutoScroller
          this protected nested class implements autoscrolling
 
Constructor Summary
DropTarget()
          Construct a DropTarget
DropTarget(Component c, DropTargetListener dtl)
          Construct a DropTarget
DropTarget(Component c, int ops, DropTargetListener dtl)
          Construct a DropTarget
DropTarget(Component c, int ops, DropTargetListener dtl, boolean act)
          Construct a DropTarget
DropTarget(Component c, int ops, DropTargetListener dtl, boolean act, FlavorMap fm)
          Construct a DropTarget
 
Method Summary
 void addDropTargetListener(DropTargetListener dtl)
          Add a new DropTargetListener (UNICAST SOURCE)
 void addNotify(java.awt.peer.ComponentPeer peer)
          Notify the DropTarget that it has been associated with a Component This method is usually called from java.awt.
protected  void clearAutoscroll()
          clear autoscrolling
protected  DropTarget.DropTargetAutoScroller createDropTargetAutoScroller(Component c, Point p)
          create an embedded autoscroller
protected  DropTargetContext createDropTargetContext()
          Create the DropTargetContext associated with this DropTarget.
 void dragEnter(DropTargetDragEvent dtde)
          The DropTarget intercepts dragEnter() notifications before the registered DropTargetListener gets them.
 void dragExit(DropTargetEvent dte)
          The DropTarget intercepts dragExit() notifications before the registered DropTargetListener gets them.
 void dragOver(DropTargetDragEvent dtde)
          The DropTarget intercepts dragOver() notifications before the registered DropTargetListener gets them.
 void drop(DropTargetDropEvent dtde)
          The DropTarget intercepts drop() notifications before the registered DropTargetListener gets them.
 void dropActionChanged(DropTargetDragEvent dtde)
          The DropTarget intercepts dropActionChanged() notifications before the registered DropTargetListener gets them.
 Component getComponent()
           
 int getDefaultActions()
           
 DropTargetContext getDropTargetContext()
           
 FlavorMap getFlavorMap()
           
protected  void initializeAutoscrolling(Point p)
          initialize autoscrolling
 boolean isActive()
           
 void removeDropTargetListener(DropTargetListener dtl)
          Remove the current DropTargetListener (UNICAST SOURCE)
 void removeNotify(java.awt.peer.ComponentPeer peer)
          Notify the DropTarget that it has been disassociated from a Component This method is usually called from java.awt.
 void setActive(boolean isActive)
          set the DropTarget (in)active.
 void setComponent(Component c)
          Note: this interface is required to permit the safe association of a DropTarget with a Component in one of two ways, either: component.setDropTarget(droptarget); or droptarget.setComponent(component); The caller must have AWTPermission.setDropTarget to succeed.
 void setDefaultActions(int ops)
          Sets the default acceptable actions for this DropTarget
 void setFlavorMap(FlavorMap fm)
           
protected  void updateAutoscroll(Point dragCursorLocn)
          update autoscrolling with current cursor locn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DropTarget

public DropTarget(Component c,
                  int ops,
                  DropTargetListener dtl,
                  boolean act,
                  FlavorMap fm)
Construct a DropTarget
Parameters:
c - The Component with which this DropTarget is associated
ops - The default acceptable actions for this DropTarget
dtl - The DropTargetListener for this DropTarget
act - Is the DropTarget accepting drops.
fm - The flavorMap to use or null

DropTarget

public DropTarget(Component c,
                  int ops,
                  DropTargetListener dtl,
                  boolean act)
Construct a DropTarget
Parameters:
c - The Component with which this DropTarget is associated
ops - The default acceptable actions for this DropTarget
dtl - The DropTargetListener for this DropTarget
act - Is the DropTarget accepting drops.

DropTarget

public DropTarget()
Construct a DropTarget

DropTarget

public DropTarget(Component c,
                  DropTargetListener dtl)
Construct a DropTarget
Parameters:
c - The Component with which this DropTarget is associated
dtl - The DropTargetListener for this DropTarget

DropTarget

public DropTarget(Component c,
                  int ops,
                  DropTargetListener dtl)
Construct a DropTarget
Parameters:
c - The Component with which this DropTarget is associated
ops - The default acceptable actions for this DropTarget
dtl - The DropTargetListener for this DropTarget
Method Detail

setComponent

public void setComponent(Component c)
Note: this interface is required to permit the safe association of a DropTarget with a Component in one of two ways, either: component.setDropTarget(droptarget); or droptarget.setComponent(component); The caller must have AWTPermission.setDropTarget to succeed.
Parameters:
c - The new Component this DropTarget is to be associated with.

getComponent

public Component getComponent()
Returns:
the current Component

setDefaultActions

public void setDefaultActions(int ops)
Sets the default acceptable actions for this DropTarget
Parameters:
ops - the default actions.
See Also:
DnDConstants

getDefaultActions

public int getDefaultActions()
Returns:
the current default actions

setActive

public void setActive(boolean isActive)
set the DropTarget (in)active.
Parameters:
isActive -  

isActive

public boolean isActive()
Returns:
is the DropTarget active?

addDropTargetListener

public void addDropTargetListener(DropTargetListener dtl)
                           throws TooManyListenersException
Add a new DropTargetListener (UNICAST SOURCE)
Parameters:
dtl - The new DropTargetListener

removeDropTargetListener

public void removeDropTargetListener(DropTargetListener dtl)
Remove the current DropTargetListener (UNICAST SOURCE)
Parameters:
dtl - the DropTargetListener to deregister.

dragEnter

public void dragEnter(DropTargetDragEvent dtde)
The DropTarget intercepts dragEnter() notifications before the registered DropTargetListener gets them.
Specified by:
dragEnter in interface DropTargetListener

dragOver

public void dragOver(DropTargetDragEvent dtde)
The DropTarget intercepts dragOver() notifications before the registered DropTargetListener gets them.
Specified by:
dragOver in interface DropTargetListener

dropActionChanged

public void dropActionChanged(DropTargetDragEvent dtde)
The DropTarget intercepts dropActionChanged() notifications before the registered DropTargetListener gets them.
Specified by:
dropActionChanged in interface DropTargetListener

dragExit

public void dragExit(DropTargetEvent dte)
The DropTarget intercepts dragExit() notifications before the registered DropTargetListener gets them.
Specified by:
dragExit in interface DropTargetListener

drop

public void drop(DropTargetDropEvent dtde)
The DropTarget intercepts drop() notifications before the registered DropTargetListener gets them.
Specified by:
drop in interface DropTargetListener

getFlavorMap

public FlavorMap getFlavorMap()
Returns:
the FlavorMap for this DropTarget

setFlavorMap

public void setFlavorMap(FlavorMap fm)
Parameters:
set - the new flavormap, or null for default

addNotify

public void addNotify(java.awt.peer.ComponentPeer peer)
Notify the DropTarget that it has been associated with a Component This method is usually called from java.awt.Component.addNotify() of the Component associated with this DropTarget to notify the DropTarget that a ComponentPeer has been associated with that Component. Calling this method, other than to notify this DropTarget of the association of the ComponentPeer with the Component may result in a malfunction of the DnD system.
Parameters:
peer - The Peer of the Component we are associated with!

removeNotify

public void removeNotify(java.awt.peer.ComponentPeer peer)
Notify the DropTarget that it has been disassociated from a Component This method is usually called from java.awt.Component.removeNotify() of the Component associated with this DropTarget to notify the DropTarget that a ComponentPeer has been disassociated with that Component. Calling this method, other than to notify this DropTarget of the disassociation of the ComponentPeer from the Component may result in a malfunction of the DnD system.
Parameters:
peer - The Peer of the Component we are being disassociated froe!

getDropTargetContext

public DropTargetContext getDropTargetContext()
Returns:
the DropTargetContext associated with this DropTarget.

createDropTargetContext

protected DropTargetContext createDropTargetContext()
Create the DropTargetContext associated with this DropTarget. Subclasses may override this method to instantiate their own DropTargetContext subclass. This call is typically *only* called by the platform's DropTargetContextPeer as a drag operation encounters this DropTarget. Accessing the Context while no Drag is current has undefined results.

createDropTargetAutoScroller

protected DropTarget.DropTargetAutoScroller createDropTargetAutoScroller(Component c,
                                                                         Point p)
create an embedded autoscroller

initializeAutoscrolling

protected void initializeAutoscrolling(Point p)
initialize autoscrolling

updateAutoscroll

protected void updateAutoscroll(Point dragCursorLocn)
update autoscrolling with current cursor locn

clearAutoscroll

protected void clearAutoscroll()
clear autoscrolling

Java Platform 1.2
Beta 4

Submit a bug or feature
Submit comments/suggestions about new javadoc look
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.
This documentation was generated with a post-Beta4 version of Javadoc.