1 19 20 package org.openharmonise.him.dnd; 21 22 import java.awt.Component ; 23 import java.awt.Cursor ; 24 import java.awt.Point ; 25 import java.awt.Toolkit ; 26 import java.awt.dnd.DragGestureEvent ; 27 import java.awt.dnd.DragGestureListener ; 28 import java.awt.dnd.DragGestureRecognizer ; 29 import java.awt.dnd.DragSource ; 30 import java.awt.dnd.DragSourceDragEvent ; 31 import java.awt.dnd.DragSourceDropEvent ; 32 import java.awt.dnd.DragSourceEvent ; 33 import java.awt.dnd.DragSourceListener ; 34 35 import javax.swing.ImageIcon ; 36 37 import org.openharmonise.him.displaycomponents.table.*; 38 import org.openharmonise.vfs.gui.*; 39 40 41 49 public class TableDragSource 50 implements DragSourceListener , DragGestureListener { 51 52 DragSource source; 53 DragGestureRecognizer recognizer; 54 TableEntry sourceTable; 55 56 63 public TableDragSource(TableEntry table, Component comp, int actions) { 64 sourceTable=table; 65 source = new DragSource (); 66 recognizer = source.createDefaultDragGestureRecognizer(comp, actions, this); 67 } 68 69 72 public void dragEnter(DragSourceDragEvent arg0) { 73 } 74 75 78 public void dragOver(DragSourceDragEvent arg0) { 79 } 80 81 84 public void dropActionChanged(DragSourceDragEvent arg0) { 85 } 86 87 90 public void dragDropEnd(DragSourceDropEvent arg0) { 91 } 92 93 96 public void dragExit(DragSourceEvent arg0) { 97 } 98 99 102 public void dragGestureRecognized(DragGestureEvent dge) { 103 Cursor cursor = Toolkit.getDefaultToolkit().createCustomCursor( ((ImageIcon )IconManager.getInstance().getIcon("16-pointer-drag.gif")).getImage(), new Point (3,1),"COPY"); 104 105 dge.startDrag(cursor, new VirtualFileTransferable( this.sourceTable.getVFS().getVirtualFile(this.sourceTable.getDragVirtualFilePath()).getResource() ), this); 106 } 107 108 } | Popular Tags |