copying Image to system clipboard  
Author Message
rfractal30





PostPosted: 2005-3-28 19:45:00 Top

java-programmer, copying Image to system clipboard Hi

As far as I can tell this is not possible to copy an Image to the
system clipboard with java at the moment. However I need it for a
project I'm working on. Has anyone found any hacks to make this
possible? Also, are there any chances that this feature will be
incorporated into the JDK at some point in the future? Are plans in the
offing?

Thanks for any advice.

Michael

 
Torsten Reitemeyer





PostPosted: 2005-3-28 20:12:00 Top

java-programmer >> copying Image to system clipboard Hi Michael,

have a look at:
http://www.javaalmanac.com/egs/java.awt.datatransfer/ToClipImg.html
(e638)

hth
torsten



 
denzel





PostPosted: 2006-10-25 20:23:00 Top

java-programmer >> copying Image to system clipboard Hello,

i can't copy any image to the system clipboard! I've seen post like this
from 1997 in google groups, but i can't find any workaround (except this
one which doesn't work for me):

http://elliotth.blogspot.com/2005/09/copying-images-to-clipboard-with-java.html

Since we are in 2006, i hope there is some kind of workaround. The
things wich works are:
- requesting current contents (very slow)
- copy/pasting text
- pasting image from Gimp (very slow) with these DataFlavors:

java.awt.datatransfer.DataFlavor[mimetype=image/png;representationclass=java.io.InputStream]
java.awt.datatransfer.DataFlavor[mimetype=image/jpeg;representationclass=java.io.InputStream]
java.awt.datatransfer.DataFlavor[mimetype=image/bmp;representationclass=java.io.InputStream]
java.awt.datatransfer.DataFlavor[mimetype=image/x-java-image;representationclass=java.awt.Image]
java.awt.datatransfer.DataFlavor[mimetype=image/x-java-image;representationclass=java.awt.Image]

- but i can't copy to the clipboard!!! In fact the copy occurs in the
JVM Clipboard since i can paste it agin in Java, but i can't accesse to
it from OpenOffice, or The Gimp.

Also, if i do getContents() after setContents(), i have a
TransferableProxy whose local field is true. How can i change this?

(JDK 1.5.0_08, linux)

TIA