public void drop(DropTargetDropEvent evt) {

// Called when the user finishes or cancels the drag operation

            try {

                Transferable transferable = evt.getTransferable();

                if (transferable.isDataFlavorSupported(DataFlavor.stringFlavor)) {

                    evt.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);

                    String dragContents = (String) transferable.getTransferData(DataFlavor.stringFlavor);

                    evt.getDropTargetContext().dropComplete(true);

                    // We append the label text to the text area when dropped

                    setText(getText() + " " + dragContents);

                } else {

                    evt.rejectDrop();

                }

            } catch (IOException e) {

                evt.rejectDrop();

            } catch (UnsupportedFlavorException e) {

                evt.rejectDrop();

            }
        }