e641. 使一个组件成为拖放目标

  public class DropTargetComponent extends JComponent implements DropTargetListener {
        public DropTargetComponent() {
            new DropTarget(this, this);
        }
        public void dragEnter(DropTargetDragEvent evt) {
            // Called when the user is dragging and enters this drop target.
        }
        public void dragOver(DropTargetDragEvent evt) {
            // Called when the user is dragging and moves over this drop target.
        }
        public void dragExit(DropTargetEvent evt) {
            // Called when the user is dragging and leaves this drop target.
        }
        public void dropActionChanged(DropTargetDragEvent evt) {
            // Called when the user changes the drag action between copy or move.
        }
        public void drop(DropTargetDropEvent evt) {
            // Called when the user finishes or cancels the drag operation.
        }
    }

 

Related Examples
posted @ 2018-09-02 21:13  borter  阅读(282)  评论(0编辑  收藏  举报