下面列出了怎么用java.awt.dnd.peer.DropTargetContextPeer的API类实例代码及写法,或者点击链接到github查看源代码。
/**
* 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;
}
}
/**
* get the Transferable (proxy) operand of this operation
*
* @throws InvalidDnDOperationException if a drag is not outstanding/extant
*
* @return the {@code Transferable}
*/
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;
}
}
/**
* get the Transferable (proxy) operand of this operation
*
* @throws InvalidDnDOperationException if a drag is not outstanding/extant
*
* @return the {@code Transferable}
*/
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;
}
}
/**
* 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;
}
}
/**
* 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;
}
}
/**
* 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;
}
}
/**
* 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;
}
}
/**
* This method returns an <code>int</code> representing the
* current actions this <code>DropTarget</code> will accept.
* <P>
* @return the current actions acceptable to this <code>DropTarget</code>
*/
protected int getTargetActions() {
DropTargetContextPeer peer = getDropTargetContextPeer();
return ((peer != null)
? peer.getTargetActions()
: dropTarget.getDefaultActions()
);
}
/**
* called to signal that the drop is acceptable
* using the specified operation.
* must be called during DropTargetListener.drop method invocation.
* <P>
* @param dropOperation the supported action(s)
*/
protected void acceptDrop(int dropOperation) {
DropTargetContextPeer peer = getDropTargetContextPeer();
if (peer != null) {
peer.acceptDrop(dropOperation);
}
}
/**
* accept the Drag.
* <P>
* @param dragOperation the supported action(s)
*/
protected void acceptDrag(int dragOperation) {
DropTargetContextPeer peer = getDropTargetContextPeer();
if (peer != null) {
peer.acceptDrag(dragOperation);
}
}
/**
* reject the Drag.
*/
protected void rejectDrag() {
DropTargetContextPeer peer = getDropTargetContextPeer();
if (peer != null) {
peer.rejectDrag();
}
}
/**
* called to signal that the drop is unacceptable.
* must be called during DropTargetListener.drop method invocation.
*/
protected void rejectDrop() {
DropTargetContextPeer peer = getDropTargetContextPeer();
if (peer != null) {
peer.rejectDrop();
}
}
/**
* accept the Drag.
*
* @param dragOperation the supported action(s)
*/
protected void acceptDrag(int dragOperation) {
DropTargetContextPeer peer = getDropTargetContextPeer();
if (peer != null) {
peer.acceptDrag(dragOperation);
}
}
/**
* called to signal that the drop is acceptable
* using the specified operation.
* must be called during DropTargetListener.drop method invocation.
*
* @param dropOperation the supported action(s)
*/
protected void acceptDrop(int dropOperation) {
DropTargetContextPeer peer = getDropTargetContextPeer();
if (peer != null) {
peer.acceptDrop(dropOperation);
}
}
/**
* 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);
}
}
/**
* called to signal that the drop is unacceptable.
* must be called during DropTargetListener.drop method invocation.
*/
protected void rejectDrop() {
DropTargetContextPeer peer = getDropTargetContextPeer();
if (peer != null) {
peer.rejectDrop();
}
}
/**
* accept the Drag.
* <P>
* @param dragOperation the supported action(s)
*/
protected void acceptDrag(int dragOperation) {
DropTargetContextPeer peer = getDropTargetContextPeer();
if (peer != null) {
peer.acceptDrag(dragOperation);
}
}
/**
* reject the Drag.
*/
protected void rejectDrag() {
DropTargetContextPeer peer = getDropTargetContextPeer();
if (peer != null) {
peer.rejectDrag();
}
}
/**
* This method returns an <code>int</code> representing the
* current actions this <code>DropTarget</code> will accept.
* <P>
* @return the current actions acceptable to this <code>DropTarget</code>
*/
protected int getTargetActions() {
DropTargetContextPeer peer = getDropTargetContextPeer();
return ((peer != null)
? peer.getTargetActions()
: dropTarget.getDefaultActions()
);
}
/**
* called to signal that the drop is acceptable
* using the specified operation.
* must be called during DropTargetListener.drop method invocation.
* <P>
* @param dropOperation the supported action(s)
*/
protected void acceptDrop(int dropOperation) {
DropTargetContextPeer peer = getDropTargetContextPeer();
if (peer != null) {
peer.acceptDrop(dropOperation);
}
}
/**
* 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);
}
}
/**
* This method returns an <code>int</code> representing the
* current actions this <code>DropTarget</code> will accept.
* <P>
* @return the current actions acceptable to this <code>DropTarget</code>
*/
protected int getTargetActions() {
DropTargetContextPeer peer = getDropTargetContextPeer();
return ((peer != null)
? peer.getTargetActions()
: dropTarget.getDefaultActions()
);
}
/**
* called to signal that the drop is unacceptable.
* must be called during DropTargetListener.drop method invocation.
*/
protected void rejectDrop() {
DropTargetContextPeer peer = getDropTargetContextPeer();
if (peer != null) {
peer.rejectDrop();
}
}
/**
* accept the Drag.
* <P>
* @param dragOperation the supported action(s)
*/
protected void acceptDrag(int dragOperation) {
DropTargetContextPeer peer = getDropTargetContextPeer();
if (peer != null) {
peer.acceptDrag(dragOperation);
}
}
/**
* reject the Drag.
*/
protected void rejectDrag() {
DropTargetContextPeer peer = getDropTargetContextPeer();
if (peer != null) {
peer.rejectDrag();
}
}
/**
* called to signal that the drop is unacceptable.
* must be called during DropTargetListener.drop method invocation.
*/
protected void rejectDrop() {
DropTargetContextPeer peer = getDropTargetContextPeer();
if (peer != null) {
peer.rejectDrop();
}
}
/**
* This method returns an <code>int</code> representing the
* current actions this <code>DropTarget</code> will accept.
* <P>
* @return the current actions acceptable to this <code>DropTarget</code>
*/
protected int getTargetActions() {
DropTargetContextPeer peer = getDropTargetContextPeer();
return ((peer != null)
? peer.getTargetActions()
: dropTarget.getDefaultActions()
);
}
/**
* called to signal that the drop is acceptable
* using the specified operation.
* must be called during DropTargetListener.drop method invocation.
* <P>
* @param dropOperation the supported action(s)
*/
protected void acceptDrop(int dropOperation) {
DropTargetContextPeer peer = getDropTargetContextPeer();
if (peer != null) {
peer.acceptDrop(dropOperation);
}
}
/**
* This method returns an <code>int</code> representing the
* current actions this <code>DropTarget</code> will accept.
* <P>
* @return the current actions acceptable to this <code>DropTarget</code>
*/
protected int getTargetActions() {
DropTargetContextPeer peer = getDropTargetContextPeer();
return ((peer != null)
? peer.getTargetActions()
: dropTarget.getDefaultActions()
);
}
/**
* This method returns an <code>int</code> representing the
* current actions this <code>DropTarget</code> will accept.
* <P>
* @return the current actions acceptable to this <code>DropTarget</code>
*/
protected int getTargetActions() {
DropTargetContextPeer peer = getDropTargetContextPeer();
return ((peer != null)
? peer.getTargetActions()
: dropTarget.getDefaultActions()
);
}