java.awt.dnd.DragSourceDropEvent Java Examples

The following examples show how to use java.awt.dnd.DragSourceDropEvent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SunDragSourceContextPeer.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
EventDispatcher(int dispatchType, DragSourceEvent event) {
    switch (dispatchType) {
    case DISPATCH_ENTER:
    case DISPATCH_MOTION:
    case DISPATCH_CHANGED:
    case DISPATCH_MOUSE_MOVED:
        if (!(event instanceof DragSourceDragEvent)) {
            throw new IllegalArgumentException("Event: " + event);
        }
        break;
    case DISPATCH_EXIT:
        break;
    case DISPATCH_FINISH:
        if (!(event instanceof DragSourceDropEvent)) {
            throw new IllegalArgumentException("Event: " + event);
        }
        break;
    default:
        throw new IllegalArgumentException("Dispatch type: " +
                                           dispatchType);
    }

    this.dispatchType  = dispatchType;
    this.event         = event;
}
 
Example #2
Source File: SunDragSourceContextPeer.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * upcall from native code via implemented class (do)
 */

protected final void dragDropFinished(final boolean success,
                                      final int operations,
                                      final int x, final int y) {
    DragSourceEvent event =
        new DragSourceDropEvent(getDragSourceContext(),
                                operations & sourceActions,
                                success, x, y);
    EventDispatcher dispatcher =
        new EventDispatcher(DISPATCH_FINISH, event);

    SunToolkit.invokeLaterOnAppContext(
        SunToolkit.targetToAppContext(getComponent()), dispatcher);

    startSecondaryEventLoop();
    setNativeContext(0);
    dragImage = null;
    dragImageOffset = null;
}
 
Example #3
Source File: SunDragSourceContextPeer.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
EventDispatcher(int dispatchType, DragSourceEvent event) {
    switch (dispatchType) {
    case DISPATCH_ENTER:
    case DISPATCH_MOTION:
    case DISPATCH_CHANGED:
    case DISPATCH_MOUSE_MOVED:
        if (!(event instanceof DragSourceDragEvent)) {
            throw new IllegalArgumentException("Event: " + event);
        }
        break;
    case DISPATCH_EXIT:
        break;
    case DISPATCH_FINISH:
        if (!(event instanceof DragSourceDropEvent)) {
            throw new IllegalArgumentException("Event: " + event);
        }
        break;
    default:
        throw new IllegalArgumentException("Dispatch type: " +
                                           dispatchType);
    }

    this.dispatchType  = dispatchType;
    this.event         = event;
}
 
Example #4
Source File: SunDragSourceContextPeer.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
EventDispatcher(int dispatchType, DragSourceEvent event) {
    switch (dispatchType) {
    case DISPATCH_ENTER:
    case DISPATCH_MOTION:
    case DISPATCH_CHANGED:
    case DISPATCH_MOUSE_MOVED:
        if (!(event instanceof DragSourceDragEvent)) {
            throw new IllegalArgumentException("Event: " + event);
        }
        break;
    case DISPATCH_EXIT:
        break;
    case DISPATCH_FINISH:
        if (!(event instanceof DragSourceDropEvent)) {
            throw new IllegalArgumentException("Event: " + event);
        }
        break;
    default:
        throw new IllegalArgumentException("Dispatch type: " +
                                           dispatchType);
    }

    this.dispatchType  = dispatchType;
    this.event         = event;
}
 
Example #5
Source File: ImageTransferTest.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
ImageDragSource() {
    formats = retrieveFormatsToTest();
    passedArray = new boolean[formats.length];
    final DragSourceListener dsl = new DragSourceAdapter() {
        public void dragDropEnd(DragSourceDropEvent e) {
            System.err.println("Drop was successful=" + e.getDropSuccess());
            notifyTransferSuccess(e.getDropSuccess());
            if (++fi < formats.length) {
                leaveFormat(formats[fi]);
            }
        }
    };

    new DragSource().createDefaultDragGestureRecognizer(frame,
            DnDConstants.ACTION_COPY,
            dge -> dge.startDrag(null, new ImageSelection(image), dsl));
    leaveFormat(formats[fi]);
}
 
Example #6
Source File: SunDragSourceContextPeer.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * upcall from native code via implemented class (do)
 */

protected final void dragDropFinished(final boolean success,
                                      final int operations,
                                      final int x, final int y) {
    DragSourceEvent event =
        new DragSourceDropEvent(getDragSourceContext(),
                                operations & sourceActions,
                                success, x, y);
    EventDispatcher dispatcher =
        new EventDispatcher(DISPATCH_FINISH, event);

    SunToolkit.invokeLaterOnAppContext(
        SunToolkit.targetToAppContext(getComponent()), dispatcher);

    startSecondaryEventLoop();
    setNativeContext(0);
    dragImage = null;
    dragImageOffset = null;
}
 
Example #7
Source File: ImageTransferTest.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
ImageDragSource() {
    formats = retrieveFormatsToTest();
    passedArray = new boolean[formats.length];
    final DragSourceListener dsl = new DragSourceAdapter() {
        public void dragDropEnd(DragSourceDropEvent e) {
            System.err.println("Drop was successful=" + e.getDropSuccess());
            notifyTransferSuccess(e.getDropSuccess());
            if (++fi < formats.length) {
                leaveFormat(formats[fi]);
            }
        }
    };

    new DragSource().createDefaultDragGestureRecognizer(frame,
            DnDConstants.ACTION_COPY,
            dge -> dge.startDrag(null, new ImageSelection(image), dsl));
    leaveFormat(formats[fi]);
}
 
Example #8
Source File: SunDragSourceContextPeer.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * upcall from native code via implemented class (do)
 */

protected final void dragDropFinished(final boolean success,
                                      final int operations,
                                      final int x, final int y) {
    DragSourceEvent event =
        new DragSourceDropEvent(getDragSourceContext(),
                                operations & sourceActions,
                                success, x, y);
    EventDispatcher dispatcher =
        new EventDispatcher(DISPATCH_FINISH, event);

    SunToolkit.invokeLaterOnAppContext(
        SunToolkit.targetToAppContext(getComponent()), dispatcher);

    startSecondaryEventLoop();
    setNativeContext(0);
    dragImage = null;
    dragImageOffset = null;
}
 
Example #9
Source File: SunDragSourceContextPeer.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
EventDispatcher(int dispatchType, DragSourceEvent event) {
    switch (dispatchType) {
    case DISPATCH_ENTER:
    case DISPATCH_MOTION:
    case DISPATCH_CHANGED:
    case DISPATCH_MOUSE_MOVED:
        if (!(event instanceof DragSourceDragEvent)) {
            throw new IllegalArgumentException("Event: " + event);
        }
        break;
    case DISPATCH_EXIT:
        break;
    case DISPATCH_FINISH:
        if (!(event instanceof DragSourceDropEvent)) {
            throw new IllegalArgumentException("Event: " + event);
        }
        break;
    default:
        throw new IllegalArgumentException("Dispatch type: " +
                                           dispatchType);
    }

    this.dispatchType  = dispatchType;
    this.event         = event;
}
 
Example #10
Source File: SunDragSourceContextPeer.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * upcall from native code via implemented class (do)
 */

protected final void dragDropFinished(final boolean success,
                                      final int operations,
                                      final int x, final int y) {
    DragSourceEvent event =
        new DragSourceDropEvent(getDragSourceContext(),
                                operations & sourceActions,
                                success, x, y);
    EventDispatcher dispatcher =
        new EventDispatcher(DISPATCH_FINISH, event);

    SunToolkit.invokeLaterOnAppContext(
        SunToolkit.targetToAppContext(getComponent()), dispatcher);

    startSecondaryEventLoop();
    setNativeContext(0);
    dragImage = null;
    dragImageOffset = null;
}
 
Example #11
Source File: SunDragSourceContextPeer.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * upcall from native code via implemented class (do)
 */

protected final void dragDropFinished(final boolean success,
                                      final int operations,
                                      final int x, final int y) {
    DragSourceEvent event =
        new DragSourceDropEvent(getDragSourceContext(),
                                operations & sourceActions,
                                success, x, y);
    EventDispatcher dispatcher =
        new EventDispatcher(DISPATCH_FINISH, event);

    SunToolkit.invokeLaterOnAppContext(
        SunToolkit.targetToAppContext(getComponent()), dispatcher);

    startSecondaryEventLoop();
    setNativeContext(0);
    dragImage = null;
    dragImageOffset = null;
}
 
Example #12
Source File: SunDragSourceContextPeer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * upcall from native code via implemented class (do)
 */

protected final void dragDropFinished(final boolean success,
                                      final int operations,
                                      final int x, final int y) {
    DragSourceEvent event =
        new DragSourceDropEvent(getDragSourceContext(),
                                operations & sourceActions,
                                success, x, y);
    EventDispatcher dispatcher =
        new EventDispatcher(DISPATCH_FINISH, event);

    SunToolkit.invokeLaterOnAppContext(
        SunToolkit.targetToAppContext(getComponent()), dispatcher);

    startSecondaryEventLoop();
    setNativeContext(0);
    dragImage = null;
    dragImageOffset = null;
}
 
Example #13
Source File: ImageTransferTest.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
ImageDragSource() {
    formats = retrieveFormatsToTest();
    passedArray = new boolean[formats.length];
    final DragSourceListener dsl = new DragSourceAdapter() {
        public void dragDropEnd(DragSourceDropEvent e) {
            System.err.println("Drop was successful=" + e.getDropSuccess());
            notifyTransferSuccess(e.getDropSuccess());
            if (++fi < formats.length) {
                leaveFormat(formats[fi]);
            }
        }
    };

    new DragSource().createDefaultDragGestureRecognizer(frame,
            DnDConstants.ACTION_COPY,
            dge -> dge.startDrag(null, new ImageSelection(image), dsl));
    leaveFormat(formats[fi]);
}
 
Example #14
Source File: ImageTransferTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
ImageDragSource() {
    formats = retrieveFormatsToTest();
    passedArray = new boolean[formats.length];
    final DragSourceListener dsl = new DragSourceAdapter() {
        public void dragDropEnd(DragSourceDropEvent e) {
            System.err.println("Drop was successful=" + e.getDropSuccess());
            notifyTransferSuccess(e.getDropSuccess());
            if (++fi < formats.length) {
                leaveFormat(formats[fi]);
            }
        }
    };

    new DragSource().createDefaultDragGestureRecognizer(frame,
            DnDConstants.ACTION_COPY,
            dge -> dge.startDrag(null, new ImageSelection(image), dsl));
    leaveFormat(formats[fi]);
}
 
Example #15
Source File: SunDragSourceContextPeer.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
EventDispatcher(int dispatchType, DragSourceEvent event) {
    switch (dispatchType) {
    case DISPATCH_ENTER:
    case DISPATCH_MOTION:
    case DISPATCH_CHANGED:
    case DISPATCH_MOUSE_MOVED:
        if (!(event instanceof DragSourceDragEvent)) {
            throw new IllegalArgumentException("Event: " + event);
        }
        break;
    case DISPATCH_EXIT:
        break;
    case DISPATCH_FINISH:
        if (!(event instanceof DragSourceDropEvent)) {
            throw new IllegalArgumentException("Event: " + event);
        }
        break;
    default:
        throw new IllegalArgumentException("Dispatch type: " +
                                           dispatchType);
    }

    this.dispatchType  = dispatchType;
    this.event         = event;
}
 
Example #16
Source File: SunDragSourceContextPeer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
EventDispatcher(int dispatchType, DragSourceEvent event) {
    switch (dispatchType) {
    case DISPATCH_ENTER:
    case DISPATCH_MOTION:
    case DISPATCH_CHANGED:
    case DISPATCH_MOUSE_MOVED:
        if (!(event instanceof DragSourceDragEvent)) {
            throw new IllegalArgumentException("Event: " + event);
        }
        break;
    case DISPATCH_EXIT:
        break;
    case DISPATCH_FINISH:
        if (!(event instanceof DragSourceDropEvent)) {
            throw new IllegalArgumentException("Event: " + event);
        }
        break;
    default:
        throw new IllegalArgumentException("Dispatch type: " +
                                           dispatchType);
    }

    this.dispatchType  = dispatchType;
    this.event         = event;
}
 
Example #17
Source File: SunDragSourceContextPeer.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * upcall from native code via implemented class (do)
 */

protected final void dragDropFinished(final boolean success,
                                      final int operations,
                                      final int x, final int y) {
    DragSourceEvent event =
        new DragSourceDropEvent(getDragSourceContext(),
                                operations & sourceActions,
                                success, x, y);
    EventDispatcher dispatcher =
        new EventDispatcher(DISPATCH_FINISH, event);

    SunToolkit.invokeLaterOnAppContext(
        SunToolkit.targetToAppContext(getComponent()), dispatcher);

    startSecondaryEventLoop();
    setNativeContext(0);
    dragImage = null;
    dragImageOffset = null;
}
 
Example #18
Source File: SunDragSourceContextPeer.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * upcall from native code via implemented class (do)
 */

protected final void dragDropFinished(final boolean success,
                                      final int operations,
                                      final int x, final int y) {
    DragSourceEvent event =
        new DragSourceDropEvent(getDragSourceContext(),
                                operations & sourceActions,
                                success, x, y);
    EventDispatcher dispatcher =
        new EventDispatcher(DISPATCH_FINISH, event);

    SunToolkit.invokeLaterOnAppContext(
        SunToolkit.targetToAppContext(getComponent()), dispatcher);

    startSecondaryEventLoop();
    setNativeContext(0);
    dragImage = null;
    dragImageOffset = null;
}
 
Example #19
Source File: SunDragSourceContextPeer.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
EventDispatcher(int dispatchType, DragSourceEvent event) {
    switch (dispatchType) {
    case DISPATCH_ENTER:
    case DISPATCH_MOTION:
    case DISPATCH_CHANGED:
    case DISPATCH_MOUSE_MOVED:
        if (!(event instanceof DragSourceDragEvent)) {
            throw new IllegalArgumentException("Event: " + event);
        }
        break;
    case DISPATCH_EXIT:
        break;
    case DISPATCH_FINISH:
        if (!(event instanceof DragSourceDropEvent)) {
            throw new IllegalArgumentException("Event: " + event);
        }
        break;
    default:
        throw new IllegalArgumentException("Dispatch type: " +
                                           dispatchType);
    }

    this.dispatchType  = dispatchType;
    this.event         = event;
}
 
Example #20
Source File: CustomizedToolbar.java    From pumpernickel with MIT License 6 votes vote down vote up
protected void endDrag(DragSourceDropEvent e) {
	if (draggingComponent != null) {
		Point p = e.getLocation();
		SwingUtilities.convertPointFromScreen(p, this);
		if (contains(p) == false) {
			// adding this extra ability to commit changes
			// makes sure if you simply drag an element
			// off the toolbar: it gets recorded.
			setContents(getContents(new Point(-1000, -1000)));
		}
	}
	draggingComponent = null;
	/**
	 * TODO: is there some way when a drop ends if it IS accepted to NOT
	 * show the image slide back to its original location? For example: 1.
	 * Open this demo app 2. Click "Customize" 3. Drag a component off the
	 * toolbar in the window into nothingness. Note the *image* slides back
	 * to where it came from, because this is how the OS shows the drag was
	 * not accepted. But even though it was not accepted by any other
	 * entity: the drag was successful, and showing that sliding image is
	 * incorrect.
	 */
}
 
Example #21
Source File: ImageTransferTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
ImageDragSource() {
    formats = retrieveFormatsToTest();
    passedArray = new boolean[formats.length];
    final DragSourceListener dsl = new DragSourceAdapter() {
        public void dragDropEnd(DragSourceDropEvent e) {
            System.err.println("Drop was successful=" + e.getDropSuccess());
            notifyTransferSuccess(e.getDropSuccess());
            if (++fi < formats.length) {
                leaveFormat(formats[fi]);
            }
        }
    };

    new DragSource().createDefaultDragGestureRecognizer(frame,
            DnDConstants.ACTION_COPY,
            dge -> dge.startDrag(null, new ImageSelection(image), dsl));
    leaveFormat(formats[fi]);
}
 
Example #22
Source File: SunDragSourceContextPeer.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
EventDispatcher(int dispatchType, DragSourceEvent event) {
    switch (dispatchType) {
    case DISPATCH_ENTER:
    case DISPATCH_MOTION:
    case DISPATCH_CHANGED:
    case DISPATCH_MOUSE_MOVED:
        if (!(event instanceof DragSourceDragEvent)) {
            throw new IllegalArgumentException("Event: " + event);
        }
        break;
    case DISPATCH_EXIT:
        break;
    case DISPATCH_FINISH:
        if (!(event instanceof DragSourceDropEvent)) {
            throw new IllegalArgumentException("Event: " + event);
        }
        break;
    default:
        throw new IllegalArgumentException("Dispatch type: " +
                                           dispatchType);
    }

    this.dispatchType  = dispatchType;
    this.event         = event;
}
 
Example #23
Source File: SunDragSourceContextPeer.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
EventDispatcher(int dispatchType, DragSourceEvent event) {
    switch (dispatchType) {
    case DISPATCH_ENTER:
    case DISPATCH_MOTION:
    case DISPATCH_CHANGED:
    case DISPATCH_MOUSE_MOVED:
        if (!(event instanceof DragSourceDragEvent)) {
            throw new IllegalArgumentException("Event: " + event);
        }
        break;
    case DISPATCH_EXIT:
        break;
    case DISPATCH_FINISH:
        if (!(event instanceof DragSourceDropEvent)) {
            throw new IllegalArgumentException("Event: " + event);
        }
        break;
    default:
        throw new IllegalArgumentException("Dispatch type: " +
                                           dispatchType);
    }

    this.dispatchType  = dispatchType;
    this.event         = event;
}
 
Example #24
Source File: SunDragSourceContextPeer.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * upcall from native code via implemented class (do)
 */

protected final void dragDropFinished(final boolean success,
                                      final int operations,
                                      final int x, final int y) {
    DragSourceEvent event =
        new DragSourceDropEvent(getDragSourceContext(),
                                operations & sourceActions,
                                success, x, y);
    EventDispatcher dispatcher =
        new EventDispatcher(DISPATCH_FINISH, event);

    SunToolkit.invokeLaterOnAppContext(
        SunToolkit.targetToAppContext(getComponent()), dispatcher);

    startSecondaryEventLoop();
    setNativeContext(0);
    dragImage = null;
    dragImageOffset = null;
}
 
Example #25
Source File: ImageTransferTest.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
ImageDragSource() {
    formats = retrieveFormatsToTest();
    passedArray = new boolean[formats.length];
    final DragSourceListener dsl = new DragSourceAdapter() {
        public void dragDropEnd(DragSourceDropEvent e) {
            System.err.println("Drop was successful=" + e.getDropSuccess());
            notifyTransferSuccess(e.getDropSuccess());
            if (++fi < formats.length) {
                leaveFormat(formats[fi]);
            }
        }
    };

    new DragSource().createDefaultDragGestureRecognizer(frame,
            DnDConstants.ACTION_COPY,
            dge -> dge.startDrag(null, new ImageSelection(image), dsl));
    leaveFormat(formats[fi]);
}
 
Example #26
Source File: SunDragSourceContextPeer.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
EventDispatcher(int dispatchType, DragSourceEvent event) {
    switch (dispatchType) {
    case DISPATCH_ENTER:
    case DISPATCH_MOTION:
    case DISPATCH_CHANGED:
    case DISPATCH_MOUSE_MOVED:
        if (!(event instanceof DragSourceDragEvent)) {
            throw new IllegalArgumentException("Event: " + event);
        }
        break;
    case DISPATCH_EXIT:
        break;
    case DISPATCH_FINISH:
        if (!(event instanceof DragSourceDropEvent)) {
            throw new IllegalArgumentException("Event: " + event);
        }
        break;
    default:
        throw new IllegalArgumentException("Dispatch type: " +
                                           dispatchType);
    }

    this.dispatchType  = dispatchType;
    this.event         = event;
}
 
Example #27
Source File: SunDragSourceContextPeer.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * upcall from native code via implemented class (do)
 */

protected final void dragDropFinished(final boolean success,
                                      final int operations,
                                      final int x, final int y) {
    DragSourceEvent event =
        new DragSourceDropEvent(getDragSourceContext(),
                                operations & sourceActions,
                                success, x, y);
    EventDispatcher dispatcher =
        new EventDispatcher(DISPATCH_FINISH, event);

    SunToolkit.invokeLaterOnAppContext(
        SunToolkit.targetToAppContext(getComponent()), dispatcher);

    startSecondaryEventLoop();
    setNativeContext(0);
    dragImage = null;
    dragImageOffset = null;
}
 
Example #28
Source File: SunDragSourceContextPeer.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * upcall from native code via implemented class (do)
 */

protected final void dragDropFinished(final boolean success,
                                      final int operations,
                                      final int x, final int y) {
    DragSourceEvent event =
        new DragSourceDropEvent(getDragSourceContext(),
                                operations & sourceActions,
                                success, x, y);
    EventDispatcher dispatcher =
        new EventDispatcher(DISPATCH_FINISH, event);

    SunToolkit.invokeLaterOnAppContext(
        SunToolkit.targetToAppContext(getComponent()), dispatcher);

    startSecondaryEventLoop();
    setNativeContext(0);
    dragImage = null;
    dragImageOffset = null;
}
 
Example #29
Source File: SunDragSourceContextPeer.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
EventDispatcher(int dispatchType, DragSourceEvent event) {
    switch (dispatchType) {
    case DISPATCH_ENTER:
    case DISPATCH_MOTION:
    case DISPATCH_CHANGED:
    case DISPATCH_MOUSE_MOVED:
        if (!(event instanceof DragSourceDragEvent)) {
            throw new IllegalArgumentException("Event: " + event);
        }
        break;
    case DISPATCH_EXIT:
        break;
    case DISPATCH_FINISH:
        if (!(event instanceof DragSourceDropEvent)) {
            throw new IllegalArgumentException("Event: " + event);
        }
        break;
    default:
        throw new IllegalArgumentException("Dispatch type: " +
                                           dispatchType);
    }

    this.dispatchType  = dispatchType;
    this.event         = event;
}
 
Example #30
Source File: ImageTransferTest.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
ImageDragSource() {
    formats = retrieveFormatsToTest();
    passedArray = new boolean[formats.length];
    final DragSourceListener dsl = new DragSourceAdapter() {
        public void dragDropEnd(DragSourceDropEvent e) {
            System.err.println("Drop was successful=" + e.getDropSuccess());
            notifyTransferSuccess(e.getDropSuccess());
            if (++fi < formats.length) {
                leaveFormat(formats[fi]);
            }
        }
    };

    new DragSource().createDefaultDragGestureRecognizer(frame,
            DnDConstants.ACTION_COPY,
            dge -> dge.startDrag(null, new ImageSelection(image), dsl));
    leaveFormat(formats[fi]);
}