public void drop(DropTargetDropEvent e) {   
        //获取要传递的数据   
        Transferable transfer = e.getTransferable();   
        DefaultMutableTreeNode dragSource = null;   
        //是否支持树节点数据的传递   
        if (transfer.isDataFlavorSupported(DragAndDropTransferable.TREENODE_FLAVOR)) {   
            try {   
                //设置接受移动的操作   
                e.acceptDrop(DnDConstants.ACTION_MOVE);   
                //获取传递的数据   
                dragSource = (DefaultMutableTreeNode) transfer.getTransferData(   
                        DragAndDropTransferable.TREENODE_FLAVOR);   
            } catch (Exception ex) {   
                ex.printStackTrace();   
            }   
        }   
        if (dragSource == null) { //拖动的数据源为空则退出   
            //放置不成功   
            e.dropComplete(false);   
            return;   
        }   
        //获取dropTo对象   
        DropTarget dt = (DropTarget) e.getSource();   
        Component comp = dt.getComponent();   
        if (!(comp instanceof JTree)) {   
            //放置不成功   
            e.dropComplete(false);   
            return;   
        }   
        JTree jtr = (JTree) comp;   
        TreePath treePath = jtr.getPathForLocation(e.getLocation().x,e.getLocation().y);   
        if (treePath==null) {   
             //放置不成功   
            e.dropComplete(false);   
            return;   
        }   
        DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) treePath.getLastPathComponent();   
        if (!isCanDrop(dragSource,treeNode,jtr)) {   
            //放置不成功   
            e.dropComplete(false);   
            return;   
        }   
  
        //把节点添加到当前树节点下   
        treeNode.add(dragSource);   
        //更新树节点   
        ((DefaultTreeModel)jtr.getModel()).reload(treeNode);   
  
        //设置放置成功   
        e.dropComplete(true);   
    }