java.awt.dnd.peer.DragSourceContextPeer Java Examples

The following examples show how to use java.awt.dnd.peer.DragSourceContextPeer. 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: DragSource.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Start a drag, given the <code>DragGestureEvent</code>
 * that initiated the drag, the initial
 * <code>Cursor</code> to use,
 * the <code>Image</code> to drag,
 * the offset of the <code>Image</code> origin
 * from the hotspot of the <code>Cursor</code> at
 * the instant of the trigger,
 * the <code>Transferable</code> subject data
 * of the drag, the <code>DragSourceListener</code>,
 * and the <code>FlavorMap</code>.
 * <P>
 * @param trigger        the <code>DragGestureEvent</code> that initiated the drag
 * @param dragCursor     the initial {@code Cursor} for this drag operation
 *                       or {@code null} for the default cursor handling;
 *                       see <a href="DragSourceContext.html#defaultCursor">DragSourceContext</a>
 *                       for more details on the cursor handling mechanism during drag and drop
 * @param dragImage      the image to drag or {@code null}
 * @param imageOffset    the offset of the <code>Image</code> origin from the hotspot
 *                       of the <code>Cursor</code> at the instant of the trigger
 * @param transferable   the subject data of the drag
 * @param dsl            the <code>DragSourceListener</code>
 * @param flavorMap      the <code>FlavorMap</code> to use, or <code>null</code>
 * <P>
 * @throws java.awt.dnd.InvalidDnDOperationException
 *    if the Drag and Drop
 *    system is unable to initiate a drag operation, or if the user
 *    attempts to start a drag while an existing drag operation
 *    is still executing
 */

public void startDrag(DragGestureEvent   trigger,
                      Cursor             dragCursor,
                      Image              dragImage,
                      Point              imageOffset,
                      Transferable       transferable,
                      DragSourceListener dsl,
                      FlavorMap          flavorMap) throws InvalidDnDOperationException {

    SunDragSourceContextPeer.setDragDropInProgress(true);

    try {
        if (flavorMap != null) this.flavorMap = flavorMap;

        DragSourceContextPeer dscp = Toolkit.getDefaultToolkit().createDragSourceContextPeer(trigger);

        DragSourceContext     dsc = createDragSourceContext(dscp,
                                                            trigger,
                                                            dragCursor,
                                                            dragImage,
                                                            imageOffset,
                                                            transferable,
                                                            dsl
                                                            );

        if (dsc == null) {
            throw new InvalidDnDOperationException();
        }

        dscp.startDrag(dsc, dsc.getCursor(), dragImage, imageOffset); // may throw
    } catch (RuntimeException e) {
        SunDragSourceContextPeer.setDragDropInProgress(false);
        throw e;
    }
}
 
Example #2
Source File: LWCToolkit.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public DragSourceContextPeer createDragSourceContextPeer(
        DragGestureEvent dge) throws InvalidDnDOperationException {
    final LightweightFrame f = SunToolkit.getLightweightFrame(dge.getComponent());
    if (f != null) {
        return f.createDragSourceContextPeer(dge);
    }

    return CDragSourceContextPeer.createDragSourceContextPeer(dge);
}
 
Example #3
Source File: LWCToolkit.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public DragSourceContextPeer createDragSourceContextPeer(
        DragGestureEvent dge) throws InvalidDnDOperationException {
    final LightweightFrame f = SunToolkit.getLightweightFrame(dge.getComponent());
    if (f != null) {
        return f.createDragSourceContextPeer(dge);
    }

    return CDragSourceContextPeer.createDragSourceContextPeer(dge);
}
 
Example #4
Source File: DragSource.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Start a drag, given the <code>DragGestureEvent</code>
 * that initiated the drag, the initial
 * <code>Cursor</code> to use,
 * the <code>Image</code> to drag,
 * the offset of the <code>Image</code> origin
 * from the hotspot of the <code>Cursor</code> at
 * the instant of the trigger,
 * the <code>Transferable</code> subject data
 * of the drag, the <code>DragSourceListener</code>,
 * and the <code>FlavorMap</code>.
 * <P>
 * @param trigger        the <code>DragGestureEvent</code> that initiated the drag
 * @param dragCursor     the initial {@code Cursor} for this drag operation
 *                       or {@code null} for the default cursor handling;
 *                       see <a href="DragSourceContext.html#defaultCursor">DragSourceContext</a>
 *                       for more details on the cursor handling mechanism during drag and drop
 * @param dragImage      the image to drag or {@code null}
 * @param imageOffset    the offset of the <code>Image</code> origin from the hotspot
 *                       of the <code>Cursor</code> at the instant of the trigger
 * @param transferable   the subject data of the drag
 * @param dsl            the <code>DragSourceListener</code>
 * @param flavorMap      the <code>FlavorMap</code> to use, or <code>null</code>
 * <P>
 * @throws java.awt.dnd.InvalidDnDOperationException
 *    if the Drag and Drop
 *    system is unable to initiate a drag operation, or if the user
 *    attempts to start a drag while an existing drag operation
 *    is still executing
 */

public void startDrag(DragGestureEvent   trigger,
                      Cursor             dragCursor,
                      Image              dragImage,
                      Point              imageOffset,
                      Transferable       transferable,
                      DragSourceListener dsl,
                      FlavorMap          flavorMap) throws InvalidDnDOperationException {

    SunDragSourceContextPeer.setDragDropInProgress(true);

    try {
        if (flavorMap != null) this.flavorMap = flavorMap;

        DragSourceContextPeer dscp = Toolkit.getDefaultToolkit().createDragSourceContextPeer(trigger);

        DragSourceContext     dsc = createDragSourceContext(dscp,
                                                            trigger,
                                                            dragCursor,
                                                            dragImage,
                                                            imageOffset,
                                                            transferable,
                                                            dsl
                                                            );

        if (dsc == null) {
            throw new InvalidDnDOperationException();
        }

        dscp.startDrag(dsc, dsc.getCursor(), dragImage, imageOffset); // may throw
    } catch (RuntimeException e) {
        SunDragSourceContextPeer.setDragDropInProgress(false);
        throw e;
    }
}
 
Example #5
Source File: LWCToolkit.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public DragSourceContextPeer createDragSourceContextPeer(
        DragGestureEvent dge) throws InvalidDnDOperationException {
    final LightweightFrame f = SunToolkit.getLightweightFrame(dge.getComponent());
    if (f != null) {
        return f.createDragSourceContextPeer(dge);
    }

    return CDragSourceContextPeer.createDragSourceContextPeer(dge);
}
 
Example #6
Source File: DragSource.java    From Java8CN with Apache License 2.0 5 votes vote down vote up
/**
 * Start a drag, given the <code>DragGestureEvent</code>
 * that initiated the drag, the initial
 * <code>Cursor</code> to use,
 * the <code>Image</code> to drag,
 * the offset of the <code>Image</code> origin
 * from the hotspot of the <code>Cursor</code> at
 * the instant of the trigger,
 * the <code>Transferable</code> subject data
 * of the drag, the <code>DragSourceListener</code>,
 * and the <code>FlavorMap</code>.
 * <P>
 * @param trigger        the <code>DragGestureEvent</code> that initiated the drag
 * @param dragCursor     the initial {@code Cursor} for this drag operation
 *                       or {@code null} for the default cursor handling;
 *                       see <a href="DragSourceContext.html#defaultCursor">DragSourceContext</a>
 *                       for more details on the cursor handling mechanism during drag and drop
 * @param dragImage      the image to drag or {@code null}
 * @param imageOffset    the offset of the <code>Image</code> origin from the hotspot
 *                       of the <code>Cursor</code> at the instant of the trigger
 * @param transferable   the subject data of the drag
 * @param dsl            the <code>DragSourceListener</code>
 * @param flavorMap      the <code>FlavorMap</code> to use, or <code>null</code>
 * <P>
 * @throws java.awt.dnd.InvalidDnDOperationException
 *    if the Drag and Drop
 *    system is unable to initiate a drag operation, or if the user
 *    attempts to start a drag while an existing drag operation
 *    is still executing
 */

public void startDrag(DragGestureEvent   trigger,
                      Cursor             dragCursor,
                      Image              dragImage,
                      Point              imageOffset,
                      Transferable       transferable,
                      DragSourceListener dsl,
                      FlavorMap          flavorMap) throws InvalidDnDOperationException {

    SunDragSourceContextPeer.setDragDropInProgress(true);

    try {
        if (flavorMap != null) this.flavorMap = flavorMap;

        DragSourceContextPeer dscp = Toolkit.getDefaultToolkit().createDragSourceContextPeer(trigger);

        DragSourceContext     dsc = createDragSourceContext(dscp,
                                                            trigger,
                                                            dragCursor,
                                                            dragImage,
                                                            imageOffset,
                                                            transferable,
                                                            dsl
                                                            );

        if (dsc == null) {
            throw new InvalidDnDOperationException();
        }

        dscp.startDrag(dsc, dsc.getCursor(), dragImage, imageOffset); // may throw
    } catch (RuntimeException e) {
        SunDragSourceContextPeer.setDragDropInProgress(false);
        throw e;
    }
}
 
Example #7
Source File: XToolkit.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException {
    final LightweightFrame f = SunToolkit.getLightweightFrame(dge.getComponent());
    if (f != null) {
        return f.createDragSourceContextPeer(dge);
    }

    return XDragSourceContextPeer.createDragSourceContextPeer(dge);
}
 
Example #8
Source File: XToolkit.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException {
    final LightweightFrame f = SunToolkit.getLightweightFrame(dge.getComponent());
    if (f != null) {
        return f.createDragSourceContextPeer(dge);
    }

    return XDragSourceContextPeer.createDragSourceContextPeer(dge);
}
 
Example #9
Source File: WToolkit.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * create the peer for a DragSourceContext
 */

@Override
public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException {
    final LightweightFrame f = SunToolkit.getLightweightFrame(dge.getComponent());
    if (f != null) {
        return f.createDragSourceContextPeer(dge);
    }

    return WDragSourceContextPeer.createDragSourceContextPeer(dge);
}
 
Example #10
Source File: XToolkit.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException {
    final LightweightFrame f = SunToolkit.getLightweightFrame(dge.getComponent());
    if (f != null) {
        return f.createDragSourceContextPeer(dge);
    }

    return XDragSourceContextPeer.createDragSourceContextPeer(dge);
}
 
Example #11
Source File: XToolkit.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException {
    final LightweightFrame f = SunToolkit.getLightweightFrame(dge.getComponent());
    if (f != null) {
        return f.createDragSourceContextPeer(dge);
    }

    return XDragSourceContextPeer.createDragSourceContextPeer(dge);
}
 
Example #12
Source File: LWCToolkit.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public DragSourceContextPeer createDragSourceContextPeer(
        DragGestureEvent dge) throws InvalidDnDOperationException {
    final LightweightFrame f = SunToolkit.getLightweightFrame(dge.getComponent());
    if (f != null) {
        return f.createDragSourceContextPeer(dge);
    }

    return CDragSourceContextPeer.createDragSourceContextPeer(dge);
}
 
Example #13
Source File: WToolkit.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * create the peer for a DragSourceContext
 */

@Override
public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException {
    final LightweightFrame f = SunToolkit.getLightweightFrame(dge.getComponent());
    if (f != null) {
        return f.createDragSourceContextPeer(dge);
    }

    return WDragSourceContextPeer.createDragSourceContextPeer(dge);
}
 
Example #14
Source File: WToolkit.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * create the peer for a DragSourceContext
 */

@Override
public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException {
    final LightweightFrame f = SunToolkit.getLightweightFrame(dge.getComponent());
    if (f != null) {
        return f.createDragSourceContextPeer(dge);
    }

    return WDragSourceContextPeer.createDragSourceContextPeer(dge);
}
 
Example #15
Source File: DragSource.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Start a drag, given the <code>DragGestureEvent</code>
 * that initiated the drag, the initial
 * <code>Cursor</code> to use,
 * the <code>Image</code> to drag,
 * the offset of the <code>Image</code> origin
 * from the hotspot of the <code>Cursor</code> at
 * the instant of the trigger,
 * the <code>Transferable</code> subject data
 * of the drag, the <code>DragSourceListener</code>,
 * and the <code>FlavorMap</code>.
 * <P>
 * @param trigger        the <code>DragGestureEvent</code> that initiated the drag
 * @param dragCursor     the initial {@code Cursor} for this drag operation
 *                       or {@code null} for the default cursor handling;
 *                       see <a href="DragSourceContext.html#defaultCursor">DragSourceContext</a>
 *                       for more details on the cursor handling mechanism during drag and drop
 * @param dragImage      the image to drag or {@code null}
 * @param imageOffset    the offset of the <code>Image</code> origin from the hotspot
 *                       of the <code>Cursor</code> at the instant of the trigger
 * @param transferable   the subject data of the drag
 * @param dsl            the <code>DragSourceListener</code>
 * @param flavorMap      the <code>FlavorMap</code> to use, or <code>null</code>
 * <P>
 * @throws java.awt.dnd.InvalidDnDOperationException
 *    if the Drag and Drop
 *    system is unable to initiate a drag operation, or if the user
 *    attempts to start a drag while an existing drag operation
 *    is still executing
 */

public void startDrag(DragGestureEvent   trigger,
                      Cursor             dragCursor,
                      Image              dragImage,
                      Point              imageOffset,
                      Transferable       transferable,
                      DragSourceListener dsl,
                      FlavorMap          flavorMap) throws InvalidDnDOperationException {

    SunDragSourceContextPeer.setDragDropInProgress(true);

    try {
        if (flavorMap != null) this.flavorMap = flavorMap;

        DragSourceContextPeer dscp = Toolkit.getDefaultToolkit().createDragSourceContextPeer(trigger);

        DragSourceContext     dsc = createDragSourceContext(dscp,
                                                            trigger,
                                                            dragCursor,
                                                            dragImage,
                                                            imageOffset,
                                                            transferable,
                                                            dsl
                                                            );

        if (dsc == null) {
            throw new InvalidDnDOperationException();
        }

        dscp.startDrag(dsc, dsc.getCursor(), dragImage, imageOffset); // may throw
    } catch (RuntimeException e) {
        SunDragSourceContextPeer.setDragDropInProgress(false);
        throw e;
    }
}
 
Example #16
Source File: HToolkit.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public DragSourceContextPeer createDragSourceContextPeer(
    DragGestureEvent dge)
    throws InvalidDnDOperationException {
    throw new InvalidDnDOperationException("Headless environment");
}
 
Example #17
Source File: ExceptionContract.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
@Override
public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException {
    return null;
}
 
Example #18
Source File: LightweightContent.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create a drag source context peer for the lightweight frame.
 */
default public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException
{
    return null;
}
 
Example #19
Source File: ExceptionContract.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException {
    return null;
}
 
Example #20
Source File: JLightweightFrame.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException {
    return content == null ? null : content.createDragSourceContextPeer(dge);
}
 
Example #21
Source File: SunToolkit.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public abstract DragSourceContextPeer createDragSourceContextPeer(
DragGestureEvent dge)
throws InvalidDnDOperationException;
 
Example #22
Source File: HeadlessToolkit.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public DragSourceContextPeer createDragSourceContextPeer(
    DragGestureEvent dge)
    throws InvalidDnDOperationException {
    throw new InvalidDnDOperationException("Headless environment");
}
 
Example #23
Source File: UtilitiesTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException {
    throw new IllegalStateException("Method not implemented");
}
 
Example #24
Source File: XToolkit.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException {
    return XDragSourceContextPeer.createDragSourceContextPeer(dge);
}
 
Example #25
Source File: SunToolkit.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
public abstract DragSourceContextPeer createDragSourceContextPeer(
DragGestureEvent dge)
throws InvalidDnDOperationException;
 
Example #26
Source File: SunToolkit.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public abstract DragSourceContextPeer createDragSourceContextPeer(
DragGestureEvent dge)
throws InvalidDnDOperationException;
 
Example #27
Source File: ComponentFactory.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
DragSourceContextPeer createDragSourceContextPeer(
DragGestureEvent dge)
throws InvalidDnDOperationException, HeadlessException;
 
Example #28
Source File: ExceptionContract.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException {
    return null;
}
 
Example #29
Source File: JLightweightFrame.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException {
    return content == null ? null : content.createDragSourceContextPeer(dge);
}
 
Example #30
Source File: LightweightContent.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create a drag source context peer for the lightweight frame.
 */
default public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException
{
    return null;
}