Hi,
I'm trying to cut & paste string selections in Java on Linux, and am
running into some problems. Cut & paste works fine between Java
applications that pass DataFlavor.stringFlavor types, but when I try to
cut & paste between non-Java applications and Java, the Transferrable is
of type sun.awt.motif.X11Selection, and calling getTransferDataFlavors()
on the transferrable returns null - i.e. there is no way to get data
from the transferrable selection. The same code works fine under
Windows - selections there are instances of
java.awt.datatransfer.StringSelection, and they support both
DataFlavor.stringFlavor and DataFlavor.plainTextFlavor. Can anyone tell
me why this is happening?
Here's a code snippet:
Toolkit tk = Toolkit.getDefaultToolkit();
Clipboard clipboard = tk.getSystemClipboard();
Transferable trans = clipboard.getContents(this);
DataFlavor flavors[] = trans.getTransferDataFlavors(); // returns null
under Linux jdk1.2 pre-v2
Object data = trans.getTransferData(DataFlavor.stringFlavor); //
java.io.IOException: could not get transfer data at
sun.awt.motif.X11Selection.getTransferData(X11Selection.java:273)
Thanks,
Edwin
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]