Search in sources :

Example 1 with DropTargetContextPeer

use of java.awt.dnd.peer.DropTargetContextPeer in project jdk8u_jdk by JetBrains.

the class DropTargetContext method setTargetActions.

/**
     * This method sets the current actions acceptable to
     * this <code>DropTarget</code>.
     * <P>
     * @param actions an <code>int</code> representing the supported action(s)
     */
protected void setTargetActions(int actions) {
    DropTargetContextPeer peer = getDropTargetContextPeer();
    if (peer != null) {
        synchronized (peer) {
            peer.setTargetActions(actions);
            getDropTarget().doSetDefaultActions(actions);
        }
    } else {
        getDropTarget().doSetDefaultActions(actions);
    }
}
Also used : DropTargetContextPeer(java.awt.dnd.peer.DropTargetContextPeer)

Example 2 with DropTargetContextPeer

use of java.awt.dnd.peer.DropTargetContextPeer in project jdk8u_jdk by JetBrains.

the class DropTargetContext method getTransferable.

/**
     * get the Transferable (proxy) operand of this operation
     * <P>
     * @throws InvalidDnDOperationException if a drag is not outstanding/extant
     * <P>
     * @return the <code>Transferable</code>
     */
protected Transferable getTransferable() throws InvalidDnDOperationException {
    DropTargetContextPeer peer = getDropTargetContextPeer();
    if (peer == null) {
        throw new InvalidDnDOperationException();
    } else {
        if (transferable == null) {
            Transferable t = peer.getTransferable();
            boolean isLocal = peer.isTransferableJVMLocal();
            synchronized (this) {
                if (transferable == null) {
                    transferable = createTransferableProxy(t, isLocal);
                }
            }
        }
        return transferable;
    }
}
Also used : DropTargetContextPeer(java.awt.dnd.peer.DropTargetContextPeer) Transferable(java.awt.datatransfer.Transferable)

Aggregations

DropTargetContextPeer (java.awt.dnd.peer.DropTargetContextPeer)2 Transferable (java.awt.datatransfer.Transferable)1