1 7 8 package java.awt.dnd; 9 10 import java.awt.Point ; 11 12 import java.awt.datatransfer.DataFlavor ; 13 import java.awt.datatransfer.Transferable ; 14 15 import java.util.List ; 16 17 55 56 public class DropTargetDragEvent extends DropTargetEvent { 57 58 private static final long serialVersionUID = -8422265619058953682L; 59 60 80 81 public DropTargetDragEvent(DropTargetContext dtc, Point cursorLocn, int dropAction, int srcActions) { 82 super(dtc); 83 84 if (cursorLocn == null) throw new NullPointerException ("cursorLocn"); 85 86 if (dropAction != DnDConstants.ACTION_NONE && 87 dropAction != DnDConstants.ACTION_COPY && 88 dropAction != DnDConstants.ACTION_MOVE && 89 dropAction != DnDConstants.ACTION_LINK 90 ) throw new IllegalArgumentException ("dropAction" + dropAction); 91 92 if ((srcActions & ~(DnDConstants.ACTION_COPY_OR_MOVE | DnDConstants.ACTION_LINK)) != 0) throw new IllegalArgumentException ("srcActions"); 93 94 location = cursorLocn; 95 actions = srcActions; 96 this.dropAction = dropAction; 97 } 98 99 108 109 public Point getLocation() { 110 return location; 111 } 112 113 114 120 121 public DataFlavor [] getCurrentDataFlavors() { 122 return getDropTargetContext().getCurrentDataFlavors(); 123 } 124 125 131 132 public List <DataFlavor > getCurrentDataFlavorsAsList() { 133 return getDropTargetContext().getCurrentDataFlavorsAsList(); 134 } 135 136 144 145 public boolean isDataFlavorSupported(DataFlavor df) { 146 return getDropTargetContext().isDataFlavorSupported(df); 147 } 148 149 154 public int getSourceActions() { return actions; } 155 156 161 public int getDropAction() { return dropAction; } 162 163 173 public Transferable getTransferable() { 174 return getDropTargetContext().getTransferable(); 175 } 176 177 189 public void acceptDrag(int dragOperation) { 190 getDropTargetContext().acceptDrag(dragOperation); 191 } 192 193 198 public void rejectDrag() { 199 getDropTargetContext().rejectDrag(); 200 } 201 202 205 206 211 private Point location; 212 213 218 private int actions; 219 220 225 private int dropAction; 226 } 227 | Popular Tags |