/** @param e the event */ public void dragEnter(DragSourceDragEvent e) { System.out.println("draglabel enter " + e); DragSourceContext context = e.getDragSourceContext(); // intersection of the users selected action, and the source and target actions int myaction = e.getDropAction(); if ((myaction & DragLabel.this.dragAction) != 0) { context.setCursor(DragSource.DefaultCopyDrop); } else { context.setCursor(DragSource.DefaultCopyNoDrop); } }
/** @param e the event */ public void dragOver(DragSourceDragEvent e) { DragSourceContext context = e.getDragSourceContext(); int sa = context.getSourceActions(); int ua = e.getUserAction(); int da = e.getDropAction(); int ta = e.getTargetActions(); System.out.println("dl dragOver source actions" + sa); System.out.println("user action" + ua); System.out.println("drop actions" + da); System.out.println("target actions" + ta); }
/** * for example, press shift during drag to change to a link action * * @param e the event */ public void dropActionChanged(DragSourceDragEvent e) { DragSourceContext context = e.getDragSourceContext(); context.setCursor(DragSource.DefaultCopyNoDrop); }
@Override public void dragMouseMoved(DragSourceDragEvent dsde) { ImageMover.w.setLocation(new Point(dsde.getLocation().x + 2, dsde.getLocation().y + 4)); }