KickJava   Java API By Example, From Geeks To Geeks.

Java > Java SE, EE, ME > java > awt > dnd > DropTarget

java.awt.dnd
Class DropTarget

java.lang.Object
  extended by java.awt.dnd.DropTarget
All Implemented Interfaces:
DropTargetListener, Serializable, EventListener
See Also:
Top Examples, Source Code

public void addDropTargetListener(DropTargetListener dtl)
                           throws TooManyListenersException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[527]Drag Drop Data Transfer Example (Drop)
By Anonymous on 2003/11/17 09:59:12  Rate
//Data Transfer Example  ( Drop )  
 import java.awt.dnd.*; 
 import java.awt.datatransfer.*; 
  
  
 public class DropEx implements 
 DropTargetListener  {  
     DropTarget dt = new DropTarget ( this, this ) ; 
      
     public void drop ( DropTargetDropEvent dtde )   {  
         Transferable t = dtde.getTransferable (  ) ; 
  
  
         if  ( t.isDataFlavorSupported ( DataFlavor.stringFlavor )  )   {  
             dtde.acceptDrop ( DnDConstants.ACTION_MOVE ) ; 
             String s = 
              ( String ) t.getTransferData ( DataFlavor.stringFlavor ) ; 
             // Do something with the string 
             dtde.getDropTargetContext (  ) .dropComplete (  ) ; 
          }  else 
             dtde.rejectDrop (  ) ; 
             // Must catch IOException, UnsupportedFlavorException 
      }  
  }      
  
  
  
 //addDropTargetListener


public void addNotify(java.awt.peer.ComponentPeer peer)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


protected void clearAutoscroll()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


protected DropTarget.DropTargetAutoScroller createDropTargetAutoScroller(Component c,
                                                                         Point p)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


protected DropTargetContext createDropTargetContext()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void dragEnter(DropTargetDragEvent dtde)
See Also:
isActive(), NullPointerException, DropTargetListener
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void dragExit(DropTargetEvent dte)
See Also:
isActive(), DropTargetListener
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void dragOver(DropTargetDragEvent dtde)
See Also:
isActive(), NullPointerException, DropTargetListener
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void drop(DropTargetDropEvent dtde)
See Also:
isActive(), NullPointerException, DropTargetListener
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void dropActionChanged(DropTargetDragEvent dtde)
See Also:
isActive(), NullPointerException, DropTargetListener
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public DropTarget()
           throws HeadlessException
See Also:
GraphicsEnvironment.isHeadless()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public DropTarget(Component c,
                  int ops,
                  DropTargetListener dtl)
           throws HeadlessException
See Also:
GraphicsEnvironment.isHeadless()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public DropTarget(Component c,
                  int ops,
                  DropTargetListener dtl,
                  boolean act)
           throws HeadlessException
See Also:
GraphicsEnvironment.isHeadless()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public DropTarget(Component c,
                  int ops,
                  DropTargetListener dtl,
                  boolean act,
                  FlavorMap fm)
           throws HeadlessException
See Also:
GraphicsEnvironment.isHeadless()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public DropTarget(Component c,
                  DropTargetListener dtl)
           throws HeadlessException
See Also:
GraphicsEnvironment.isHeadless()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Component getComponent()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public int getDefaultActions()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public DropTargetContext getDropTargetContext()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public FlavorMap getFlavorMap()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


protected void initializeAutoscrolling(Point p)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public boolean isActive()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void removeDropTargetListener(DropTargetListener dtl)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void removeNotify(java.awt.peer.ComponentPeer peer)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setActive(boolean isActive)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setComponent(Component c)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setDefaultActions(int ops)
See Also:
DnDConstants
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setFlavorMap(FlavorMap fm)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


protected void updateAutoscroll(Point dragCursorLocn)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  

Popular Tags