JFrame frame = new JFrame("Drag and Drop File Hack");
frame.setDefaultCloseOperation(frame.EXIT_ON_CLOSE);
FileSystemView fsv = FileSystemView.getFileSystemView();
Icon icon = fsv.getSystemIcon(File.createTempFile("myfile.",".txt"));
System.out.println("icon = " + icon);
//ImageIcon iicn = (ImageIcon)icon;
frame.getContentPane().setLayout(new BorderLayout());
JTextArea text = new JTextArea();
JLabel label = new JLabel("myfile.txt",icon,SwingConstants.CENTER);
DragSource ds = DragSource.getDefaultDragSource();
DragGestureRecognizer dgr = ds.createDefaultDragGestureRecognizer(
label,
DnDConstants.ACTION_MOVE,
new FileDragGestureListener(text));
frame.getContentPane().add("North",label);
frame.getContentPane().add("Center",text);
frame.pack();
frame.setSize(400,300);
frame.setVisible(true);