Home » openjdk-7 » java » awt » dnd » [javadoc | source]
java.awt.dnd
public class: DropTarget [javadoc | source]
java.lang.Object
   java.awt.dnd.DropTarget

All Implemented Interfaces:
    Serializable, DropTargetListener

Direct Known Subclasses:
    SwingDropTarget

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

Each DropTarget is associated with a FlavorMap. The default FlavorMap hereafter designates the FlavorMap returned by SystemFlavorMap.getDefaultFlavorMap().

Nested Class Summary:
protected static class  DropTarget.DropTargetAutoScroller  this protected nested class implements autoscrolling 
Field Summary
 int actions    Default permissible actions supported by this DropTarget. 
 boolean active    true if the DropTarget is accepting Drag & Drop operations.
    serial:
 
Constructor:
 public DropTarget() throws HeadlessException 
    Creates a DropTarget.
    Throws:
    HeadlessException - if GraphicsEnvironment.isHeadless() returns true
    Also see:
    java.awt.GraphicsEnvironment#isHeadless
    exception: HeadlessException - if GraphicsEnvironment.isHeadless() returns true
 public DropTarget(Component c,
    DropTargetListener dtl) throws HeadlessException 
    Creates a DropTarget given the Component to associate itself with, and the DropTargetListener to handle event processing.

    The Component will receive drops only if it is enabled.

    Parameters:
    c - The Component with which this DropTarget is associated
    dtl - The DropTargetListener for this DropTarget
    Throws:
    HeadlessException - if GraphicsEnvironment.isHeadless() returns true
    Also see:
    java.awt.GraphicsEnvironment#isHeadless
    exception: HeadlessException - if GraphicsEnvironment.isHeadless() returns true
 public DropTarget(Component c,
    int ops,
    DropTargetListener dtl) throws HeadlessException 
    Creates a DropTarget given the Component to associate itself with, an int representing the default acceptable action(s) to support, and a DropTargetListener to handle event processing.

    The Component will receive drops only if it is enabled.

    Parameters:
    c - The Component with which this DropTarget is associated
    ops - The default acceptable actions for this DropTarget
    dtl - The DropTargetListener for this DropTarget
    Throws:
    HeadlessException - if GraphicsEnvironment.isHeadless() returns true
    Also see:
    java.awt.GraphicsEnvironment#isHeadless
    exception: HeadlessException - if GraphicsEnvironment.isHeadless() returns true
 public DropTarget(Component c,
    int ops,
    DropTargetListener dtl,
    boolean act) throws HeadlessException 
    Creates a DropTarget given the Component to associate itself with, an int representing the default acceptable action(s) to support, a DropTargetListener to handle event processing, and a boolean indicating if the DropTarget is currently accepting drops.

    The Component will receive drops only if it is enabled.

    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.
    Throws:
    HeadlessException - if GraphicsEnvironment.isHeadless() returns true
    Also see:
    java.awt.GraphicsEnvironment#isHeadless
    exception: HeadlessException - if GraphicsEnvironment.isHeadless() returns true
 public DropTarget(Component c,
    int ops,
    DropTargetListener dtl,
    boolean act,
    FlavorMap fm) throws HeadlessException 
    Creates a new DropTarget given the Component to associate itself with, an int representing the default acceptable action(s) to support, a DropTargetListener to handle event processing, a boolean indicating if the DropTarget is currently accepting drops, and a FlavorMap to use (or null for the default FlavorMap).

    The Component will receive drops only if it is enabled.

    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 for the default FlavorMap
    Throws:
    HeadlessException - if GraphicsEnvironment.isHeadless() returns true
    Also see:
    java.awt.GraphicsEnvironment#isHeadless
    exception: HeadlessException - if GraphicsEnvironment.isHeadless() returns true
Method from java.awt.dnd.DropTarget Summary:
addDropTargetListener,   addNotify,   clearAutoscroll,   createDropTargetAutoScroller,   createDropTargetContext,   doSetDefaultActions,   dragEnter,   dragExit,   dragOver,   drop,   dropActionChanged,   getComponent,   getDefaultActions,   getDropTargetContext,   getFlavorMap,   initializeAutoscrolling,   isActive,   removeDropTargetListener,   removeNotify,   setActive,   setComponent,   setDefaultActions,   setFlavorMap,   updateAutoscroll
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from java.awt.dnd.DropTarget Detail:
 public synchronized  void addDropTargetListener(DropTargetListener dtl) throws TooManyListenersException 
    Adds a new DropTargetListener (UNICAST SOURCE).

 public  void addNotify(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.

 protected  void clearAutoscroll() 
    clear autoscrolling
 protected DropTargetAutoScroller createDropTargetAutoScroller(Component c,
    Point p) 
    create an embedded autoscroller

 protected DropTargetContext createDropTargetContext() 
    Creates 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.
  void doSetDefaultActions(int ops) 
 public synchronized  void dragEnter(DropTargetDragEvent dtde) 
    Calls dragEnter on the registered DropTargetListener and passes it the specified DropTargetDragEvent. Has no effect if this DropTarget is not active.
 public synchronized  void dragExit(DropTargetEvent dte) 
    Calls dragExit on the registered DropTargetListener and passes it the specified DropTargetEvent. Has no effect if this DropTarget is not active.

    This method itself does not throw any exception for null parameter but for exceptions thrown by the respective method of the listener.

 public synchronized  void dragOver(DropTargetDragEvent dtde) 
    Calls dragOver on the registered DropTargetListener and passes it the specified DropTargetDragEvent. Has no effect if this DropTarget is not active.
 public synchronized  void drop(DropTargetDropEvent dtde) 
    Calls drop on the registered DropTargetListener and passes it the specified DropTargetDropEvent if this DropTarget is active.
 public synchronized  void dropActionChanged(DropTargetDragEvent dtde) 
    Calls dropActionChanged on the registered DropTargetListener and passes it the specified DropTargetDragEvent. Has no effect if this DropTarget is not active.
 public synchronized Component getComponent() 
    Gets the Component associated with this DropTarget.

 public int getDefaultActions() 
    Gets an int representing the current action(s) supported by this DropTarget.

 public DropTargetContext getDropTargetContext() 
    Gets the DropTargetContext associated with this DropTarget.

 public FlavorMap getFlavorMap() 
    Gets the FlavorMap associated with this DropTarget. If no FlavorMap has been set for this DropTarget, it is associated with the default FlavorMap.

 protected  void initializeAutoscrolling(Point p) 
    initialize autoscrolling

 public boolean isActive() 
    Reports whether or not this DropTarget is currently active (ready to accept drops).

 public synchronized  void removeDropTargetListener(DropTargetListener dtl) 
    Removes the current DropTargetListener (UNICAST SOURCE).

 public  void removeNotify(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.

 public synchronized  void setActive(boolean isActive) 
    Sets the DropTarget active if true, inactive if false.

 public synchronized  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 Component will receive drops only if it is enabled.

 public  void setDefaultActions(int ops) 
    Sets the default acceptable actions for this DropTarget

 public  void setFlavorMap(FlavorMap fm) 
    Sets the FlavorMap associated with this DropTarget.

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