}
}
});
DropTargetListener dropTargetSourceListener =
new DropTargetListener() {
public void dragEnter(DropTargetDragEvent e) {}
public void dragExit(DropTargetEvent e) {}
public void dragOver(DropTargetDragEvent e) {}
@SuppressWarnings("unchecked")
public void drop(DropTargetDropEvent e) {
try {
Transferable tr = e.getTransferable();
DataFlavor[] flavors = tr.getTransferDataFlavors();
for (int i = 0; i < flavors.length; i++)
if (flavors[i].isFlavorJavaFileListType()) {
// accept drop
e.acceptDrop (e.getDropAction());
List<File> files = (List<File>) tr.getTransferData(flavors[i]);
File dropFile = files.get(0);
setFileToTextfields(dropFile);
e.dropComplete(true);
return;
}
} catch (Throwable t) {}
e.rejectDrop();
}
public void dropActionChanged(
DropTargetDragEvent e) {}
};
DropTargetListener dropTargetDestinationListener =
new DropTargetListener() {
public void dragEnter(DropTargetDragEvent e) {}
public void dragExit(DropTargetEvent e) {}