DragSource dragSource = DragSource.getDefaultDragSource();
//Once the DragSource is obtained, a DragGestureRecognizer should also be obtained to associate the DragSource with a particular Component.
DragGestureRecognizer dgr = dragSource.createDefaultDragGestureRecognizer(table, DnDConstants.ACTION_MOVE, new DragGestureListener() {
publicvoiddragGestureRecognized(DragGestureEvent dge) {
// TODO Auto-generated method stub
Toolkit tk = Toolkit.getDefaultToolkit();
Dimension dim = tk.getBestCursorSize(draggedIcon.getIconWidth(),draggedIcon.getIconHeight());
BufferedImage buff = new BufferedImage(dim.width,dim.height,BufferedImage.TYPE_INT_ARGB);
draggedIcon.paintIcon(table,buff.getGraphics(),0,0);
//Reports whether or not drag Image support is available on the underlying platform.if(DragSource.isDragImageSupported()) {
Transferable tr = new StringSelection(pathOfFileToMove);
dge.startDrag(DragSource.DefaultMoveDrop,buff,new Point(0,0),tr,new DragSourceListener() {
publicvoiddropActionChanged(DragSourceDragEvent arg0) {
// TODO Auto-generated method stub
}
publicvoiddragOver(DragSourceDragEvent arg0) {
// TODO Auto-generated method stub</