* make Multi-File DnD work on Linux

This commit is contained in:
Reinhard Pointner 2009-06-30 12:12:34 +00:00
parent 6a750cb95d
commit ed40d4099e
2 changed files with 4 additions and 3 deletions

View File

@ -92,7 +92,7 @@ public class MainFrame extends JFrame {
} }
}); });
setSize(760, 615); setSize(760, 630);
} }

View File

@ -6,6 +6,7 @@ import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable; import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException; import java.awt.datatransfer.UnsupportedFlavorException;
import java.io.File; import java.io.File;
import java.nio.CharBuffer;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
@ -17,7 +18,7 @@ public class FileTransferable implements Transferable {
private static DataFlavor createUriListFlavor() { private static DataFlavor createUriListFlavor() {
try { try {
return new DataFlavor("text/uri-list;class=java.lang.String"); return new DataFlavor("text/uri-list;class=java.nio.CharBuffer");
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
// will never happen // will never happen
throw new RuntimeException(e); throw new RuntimeException(e);
@ -43,7 +44,7 @@ public class FileTransferable implements Transferable {
if (flavor.isFlavorJavaFileListType()) if (flavor.isFlavorJavaFileListType())
return Arrays.asList(files); return Arrays.asList(files);
else if (flavor.equals(uriListFlavor)) else if (flavor.equals(uriListFlavor))
return getUriList(); return CharBuffer.wrap(getUriList());
else else
throw new UnsupportedFlavorException(flavor); throw new UnsupportedFlavorException(flavor);
} }