class DroppableTextPane extends JTextPane implements DropTargetListener,
        DragSourceListener, DragGestureListener
 {
    private DragSource dragSource = DragSource.getDefaultDragSource();

    /**
     * Creates a droppable text pane.
     */
    public DroppableTextPane() {
        new DropTarget(this, this);
        dragSource.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_COPY_OR_MOVE, this);
    }

    @Override
    public void dragDropEnd(DragSourceDropEvent DragSourceDropEvent) {
    }

    @Override
    public void dragEnter(DragSourceDragEvent DragSourceDragEvent) {
    }

    @Override
    public void dragExit(DragSourceEvent DragSourceEvent) {
    }

    @Override
    public void dragOver(DragSourceDragEvent DragSourceDragEvent) {
    }

    @Override
    public void dropActionChanged(DragSourceDragEvent DragSourceDragEvent) {
    }

    @Override
    public void dragEnter(DropTargetDragEvent dropTargetDragEvent) {
        dropTargetDragEvent.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE);
    }

    @Override
    public void dragExit(DropTargetEvent dropTargetEvent) {
    }

    @Override
    public void dragOver(DropTargetDragEvent dropTargetDragEvent) {
    }

    @Override
    public void dropActionChanged(DropTargetDragEvent dropTargetDragEvent) {
    }

    @Override
    public void drop(DropTargetDropEvent dropTargetDropEvent) {<FILL_FUNCTION_BODY>}

    @Override
    public void dragGestureRecognized(DragGestureEvent dragGestureEvent) {

    }

    /**
     * Notified when a file has been dropped onto the frame.
     *
     * @param file the file that has been dropped.
     */
    public void fileDropped(File file){

    }

    /**
     * Notified when a directory has been dropped onto the frame.
     *
     * @param file the directory that has been dropped.
     */
    public void directoryDropped(File file){

    }
}

        try {
            Transferable transferable = dropTargetDropEvent.getTransferable();
            if (transferable.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
                dropTargetDropEvent.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
                List fileList = (List) transferable.getTransferData(DataFlavor.javaFileListFlavor);
                Iterator iterator = fileList.iterator();
                while (iterator.hasNext()) {
                    File file = (File) iterator.next();
                    if (file.isFile()) {
                        fileDropped(file);
                    }

                    if (file.isDirectory()) {
                        directoryDropped(file);
                    }
                }
                dropTargetDropEvent.getDropTargetContext().dropComplete(true);
            }
            else {
                dropTargetDropEvent.rejectDrop();
            }
        }
        catch (IOException | UnsupportedFlavorException io) {
            io.printStackTrace();
            dropTargetDropEvent.rejectDrop();
        }
    
<methods>public void <init>() ,public void <init>(javax.swing.text.StyledDocument) ,public javax.swing.text.Style addStyle(java.lang.String, javax.swing.text.Style) ,public javax.swing.text.AttributeSet getCharacterAttributes() ,public javax.swing.text.MutableAttributeSet getInputAttributes() ,public javax.swing.text.Style getLogicalStyle() ,public javax.swing.text.AttributeSet getParagraphAttributes() ,public javax.swing.text.Style getStyle(java.lang.String) ,public javax.swing.text.StyledDocument getStyledDocument() ,public java.lang.String getUIClassID() ,public void insertComponent(java.awt.Component) ,public void insertIcon(javax.swing.Icon) ,public void removeStyle(java.lang.String) ,public void replaceSelection(java.lang.String) ,public void setCharacterAttributes(javax.swing.text.AttributeSet, boolean) ,public void setDocument(javax.swing.text.Document) ,public final void setEditorKit(javax.swing.text.EditorKit) ,public void setLogicalStyle(javax.swing.text.Style) ,public void setParagraphAttributes(javax.swing.text.AttributeSet, boolean) ,public void setStyledDocument(javax.swing.text.StyledDocument) <variables>private static final java.lang.String uiClassID