Package docking.dnd
Class DropTgtAdapter
java.lang.Object
docking.dnd.DropTgtAdapter
- All Implemented Interfaces:
DropTargetListener,EventListener
Class to handle notifications of drag and drop operations that occur on the DropTarget
object. The DropTarget is the component that accepts drops during a drag and drop operation.
The
drop method actually transfers the data.-
Constructor Summary
ConstructorsConstructorDescriptionDropTgtAdapter(Droppable dropComponent, int acceptableDropActions, DataFlavor[] acceptableDropFlavors) Constructor -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoidvoidvoidstatic DataFlavorgetFirstMatchingFlavor(DropTargetDragEvent e, DataFlavor[] acceptableFlavors) protected booleanReturns true if the drop target can accept the data flavor that is to be droppedprotected booleanReturns true if the drop operation is OK.voidsetAcceptableDropFlavors(DataFlavor[] dropFlavors) Set the data flavors acceptable to the associated drop target
-
Constructor Details
-
DropTgtAdapter
public DropTgtAdapter(Droppable dropComponent, int acceptableDropActions, DataFlavor[] acceptableDropFlavors) Constructor- Parameters:
dropComponent- the drop targetacceptableDropActions- a DnDConstants variable that defines dnd actionsacceptableDropFlavors- acceptable data formats that the drop target can handle
-
-
Method Details
-
setAcceptableDropFlavors
Set the data flavors acceptable to the associated drop target- Parameters:
dropFlavors- the flavors
-
dragEnter
- Specified by:
dragEnterin interfaceDropTargetListener
-
dragOver
- Specified by:
dragOverin interfaceDropTargetListener
-
dragExit
- Specified by:
dragExitin interfaceDropTargetListener
-
dropActionChanged
- Specified by:
dropActionChangedin interfaceDropTargetListener
-
drop
- Specified by:
dropin interfaceDropTargetListener
-
isDropOk
Returns true if the drop operation is OK. A drop is deemed to be okay if- the drop target accepts one of the data flavors that the event's transferable provides
- the drop action (i.e. COPY, MOVE, etc.) is accepted by the target
- the drop is accepted by the Droppable component
- Parameters:
e- event that has current state of drag and drop operation- Returns:
- true if the drop operation is OK
-
isDragFlavorSupported
Returns true if the drop target can accept the data flavor that is to be dropped- Parameters:
e- event that has current state of drag and drop operation- Returns:
- true if the drop target can accept the data flavor that is to be dropped
-
getFirstMatchingFlavor
public static DataFlavor getFirstMatchingFlavor(DropTargetDragEvent e, DataFlavor[] acceptableFlavors)
-