public boolean isDropAcceptable(DropTargetDropEvent event) { // usually, you // check the // available // data flavors // here // in this program, we accept all flavors return (event.getDropAction() & DnDConstants.ACTION_COPY_OR_MOVE) != 0; }
private void processDrop(DropData dropData, DropTargetDropEvent dropTargetDropEvent) { putEntryAtPoint(dropData.whatToDrop, dropData.whereInTable); _widget.addEntry(dropData.whatToDrop); _underlyingTable.setRowSelectionInterval(dropData.whereInTable.x, dropData.whereInTable.x); _underlyingTable.setColumnSelectionInterval(dropData.whereInTable.y, dropData.whereInTable.y); dropTargetDropEvent.acceptDrop(dropTargetDropEvent.getDropAction()); dropTargetDropEvent.dropComplete(true); }
private void acceptDrop(DropTargetDropEvent dtde) { int dragaction = dtde.getDropAction(); if (dragaction != 0) { dtde.acceptDrop(dragaction); } else { dtde.acceptDrop(ALL_ACTIONS); } }
public void drop(DropTargetDropEvent dropTargetDropEvent) { DropData dropData = convertEventIntoDropData(dropTargetDropEvent); if (null == dropData) { dropTargetDropEvent.rejectDrop(); } else { int dropAction = dropTargetDropEvent.getDropAction(); if (DnDConstants.ACTION_MOVE == dropAction) { _widget.removeEntry(dropData.whatToDrop); processDrop(dropData, dropTargetDropEvent); } if (DnDConstants.ACTION_COPY == dropAction) { dropData.whatToDrop = RecursiveCopy.recursivelyCopyInstance( dropData.whatToDrop, Constants.RECURSIVE_COPY_DEPTH_FOR_DND); processDrop(dropData, dropTargetDropEvent); } } _widget.setIsCurrentlyDragging(false); return; }