public boolean isDragAcceptable(DropTargetDragEvent 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;
 }
Exemple #2
0
  private void acceptDrag(DropTargetDragEvent dtde) {
    int dragaction = dtde.getDropAction();

    if (dragaction != 0) {
      dtde.acceptDrag(dragaction);
    } else {
      dtde.acceptDrag(ALL_ACTIONS);
    }
  }
Exemple #3
0
 private void checkDrag(DropTargetDragEvent dtde) {
   int da = dtde.getDropAction();
   if (dtde.getCurrentDataFlavors().length == 0) {
     JConfig.log().logVerboseDebug("Zero length accepted... (" + da + ")");
     acceptDrag(dtde);
     return;
   }
   if (testAllFlavors(dtde) != null) {
     JConfig.log().logVerboseDebug("Accepting drag! (" + da + ")");
     acceptDrag(dtde);
   } else {
     dtde.rejectDrag();
     JConfig.log().logVerboseDebug("Rejecting drag! (" + da + ")");
   }
 }