类java.awt.dnd.DragSourceDropEvent源码实例Demo

下面列出了怎么用java.awt.dnd.DragSourceDropEvent的API类实例代码及写法,或者点击链接到github查看源代码。

/**
 * 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;
}
 
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;
}
 
源代码3 项目: dragonwell8_jdk   文件: ImageTransferTest.java
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]);
}
 
源代码4 项目: TencentKona-8   文件: SunDragSourceContextPeer.java
/**
 * 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;
}
 
源代码5 项目: TencentKona-8   文件: SunDragSourceContextPeer.java
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;
}
 
源代码6 项目: TencentKona-8   文件: ImageTransferTest.java
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]);
}
 
源代码7 项目: jdk8u60   文件: SunDragSourceContextPeer.java
/**
 * 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;
}
 
源代码8 项目: jdk8u60   文件: SunDragSourceContextPeer.java
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;
}
 
源代码9 项目: openjdk-jdk8u   文件: SunDragSourceContextPeer.java
/**
 * 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;
}
 
源代码10 项目: openjdk-jdk8u   文件: SunDragSourceContextPeer.java
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;
}
 
源代码11 项目: openjdk-jdk8u   文件: ImageTransferTest.java
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]);
}
 
/**
 * 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;
}
 
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;
}
 
源代码14 项目: openjdk-jdk8u-backup   文件: ImageTransferTest.java
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]);
}
 
源代码15 项目: Bytecoder   文件: SunDragSourceContextPeer.java
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;
}
 
源代码16 项目: openjdk-jdk9   文件: SunDragSourceContextPeer.java
/**
 * 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;
}
 
源代码17 项目: openjdk-jdk9   文件: SunDragSourceContextPeer.java
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;
}
 
源代码18 项目: openjdk-jdk9   文件: ImageTransferTest.java
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]);
}
 
源代码19 项目: jdk8u-jdk   文件: SunDragSourceContextPeer.java
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;
}
 
源代码20 项目: jdk8u-jdk   文件: ImageTransferTest.java
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]);
}
 
源代码21 项目: hottub   文件: SunDragSourceContextPeer.java
/**
 * 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;
}
 
源代码22 项目: hottub   文件: SunDragSourceContextPeer.java
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;
}
 
源代码23 项目: hottub   文件: ImageTransferTest.java
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]);
}
 
/**
 * 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;
}
 
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;
}
 
源代码26 项目: openjdk-8   文件: SunDragSourceContextPeer.java
/**
 * 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;
}
 
源代码27 项目: openjdk-8   文件: SunDragSourceContextPeer.java
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;
}
 
源代码28 项目: pumpernickel   文件: CustomizedToolbar.java
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.
	 */
}
 
源代码29 项目: jdk8u_jdk   文件: SunDragSourceContextPeer.java
/**
 * 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;
}
 
源代码30 项目: jdk8u_jdk   文件: SunDragSourceContextPeer.java
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;
}
 
 类所在包
 类方法
 同包方法