- java.lang.Object
- 
- java.awt.dnd.DropTargetContext
 
- 
- All Implemented Interfaces:
- Serializable
 
 public class DropTargetContext extends Object implements Serializable ADropTargetContextis created whenever the logical cursor associated with a Drag and Drop operation coincides with the visible geometry of aComponentassociated with aDropTarget. TheDropTargetContextprovides the mechanism for a potential receiver of a drop operation to both provide the end user with the appropriate drag under feedback, but also to effect the subsequent data transfer if appropriate.- Since:
- 1.2
- See Also:
- Serialized Form
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description protected classDropTargetContext.TransferableProxyTransferableProxyis a helper inner class that implementsTransferableinterface and serves as a proxy for anotherTransferableobject which represents data transfer for a particular drag-n-drop operation.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidacceptDrag(int dragOperation)accept the Drag.protected voidacceptDrop(int dropOperation)called to signal that the drop is acceptable using the specified operation.protected TransferablecreateTransferableProxy(Transferable t, boolean local)Creates a TransferableProxy to proxy for the specified Transferable.voiddropComplete(boolean success)This method signals that the drop is completed and if it was successful or not.ComponentgetComponent()This method returns theComponentassociated with thisDropTargetContext.protected DataFlavor[]getCurrentDataFlavors()get the available DataFlavors of theTransferableoperand of this operation.protected List<DataFlavor>getCurrentDataFlavorsAsList()This method returns a the currently available DataFlavors of theTransferableoperand as ajava.util.List.DropTargetgetDropTarget()This method returns theDropTargetassociated with thisDropTargetContext.protected intgetTargetActions()This method returns anintrepresenting the current actions thisDropTargetwill accept.protected TransferablegetTransferable()get the Transferable (proxy) operand of this operationprotected booleanisDataFlavorSupported(DataFlavor df)This method returns abooleanindicating if the givenDataFlavoris supported by thisDropTargetContext.protected voidrejectDrag()reject the Drag.protected voidrejectDrop()called to signal that the drop is unacceptable.protected voidsetTargetActions(int actions)This method sets the current actions acceptable to thisDropTarget.
 
- 
- 
- 
Method Detail- 
getDropTargetpublic DropTarget getDropTarget() This method returns theDropTargetassociated with thisDropTargetContext.- Returns:
- the DropTargetassociated with thisDropTargetContext
 
 - 
getComponentpublic Component getComponent() This method returns theComponentassociated with thisDropTargetContext.- Returns:
- the Component associated with this Context
 
 - 
setTargetActionsprotected void setTargetActions(int actions) This method sets the current actions acceptable to thisDropTarget.- Parameters:
- actions- an- intrepresenting the supported action(s)
 
 - 
getTargetActionsprotected int getTargetActions() This method returns anintrepresenting the current actions thisDropTargetwill accept.- Returns:
- the current actions acceptable to this DropTarget
 
 - 
dropCompletepublic void dropComplete(boolean success) throws InvalidDnDOperationExceptionThis method signals that the drop is completed and if it was successful or not.- Parameters:
- success- true for success, false if not
- Throws:
- InvalidDnDOperationException- if a drop is not outstanding/extant
 
 - 
acceptDragprotected void acceptDrag(int dragOperation) accept the Drag.- Parameters:
- dragOperation- the supported action(s)
 
 - 
rejectDragprotected void rejectDrag() reject the Drag.
 - 
acceptDropprotected void acceptDrop(int dropOperation) called to signal that the drop is acceptable using the specified operation. must be called during DropTargetListener.drop method invocation.- Parameters:
- dropOperation- the supported action(s)
 
 - 
rejectDropprotected void rejectDrop() called to signal that the drop is unacceptable. must be called during DropTargetListener.drop method invocation.
 - 
getCurrentDataFlavorsprotected DataFlavor[] getCurrentDataFlavors() get the available DataFlavors of theTransferableoperand of this operation.- Returns:
- a DataFlavor[]containing the supportedDataFlavors of theTransferableoperand.
 
 - 
getCurrentDataFlavorsAsListprotected List<DataFlavor> getCurrentDataFlavorsAsList() This method returns a the currently available DataFlavors of theTransferableoperand as ajava.util.List.- Returns:
- the currently available
 DataFlavors as a java.util.List
 
 - 
isDataFlavorSupportedprotected boolean isDataFlavorSupported(DataFlavor df) This method returns abooleanindicating if the givenDataFlavoris supported by thisDropTargetContext.- Parameters:
- df- the- DataFlavor
- Returns:
- if the DataFlavorspecified is supported
 
 - 
getTransferableprotected Transferable getTransferable() throws InvalidDnDOperationException get the Transferable (proxy) operand of this operation- Returns:
- the Transferable
- Throws:
- InvalidDnDOperationException- if a drag is not outstanding/extant
 
 - 
createTransferableProxyprotected Transferable createTransferableProxy(Transferable t, boolean local) Creates a TransferableProxy to proxy for the specified Transferable.- Parameters:
- t- the- Transferableto be proxied
- local-- trueif- trepresents the result of a local drag-n-drop operation.
- Returns:
- the new TransferableProxyinstance.
 
 
- 
 
-