> In the java program I am developing, I can copy an image > created by this program into the clipboard and paste it into > another image also created by this program. However, if I > open the clipboard viewer program to see what is inside the > system clipboard, the image is not there. Why? Does Java > bypass the system clipboard?
Well it depends on your operating system. On Windows operating system it usually uses the system clipboard that is available there. In that case it could be that the clipboard content viewer you are using is not supporting the flavour you set for the copied object. Then you will see nothing (as far as I remember). If your operating system is a unix environment - the things look a bit more complicated. On unix (linux,solaris) there are two different clipboards - a primary and a secondary ones. Java copies the items only into the secondary, but not into the primary ones. But the primary ones is the one that is used for most clipboard actions (i.e. mark something in an xterm window and paste it with the middle mouse button somewhere else). On these systems, the clipboard viewer will never ever show your content, because it will not show the content of the secondary, but the primary clipboard. However - java is still be able to copy the objects from one virtual java engine to another java virtual engine by using the secondary clipboard. Only the data exchange between native programs and java programs is limited in this way. There is a workaround using a native library for that problem (not very easy to use, but works for me) - it is published in: 'Java Programming on Linux' by Meyers. He describes a method to copy the content of the primary clipboard to the secondary clipboard using native code on linux. By using this code and changing it a little bit - you should be able to compile it on solaris and to extend it to copy the content of the secondary clipboard back to the primary clipboard. Then you have everythign you need. Now your program should� check if the operating system is a) windows or b) a unix system and should use either the basic clipboard functionality provided by java (for case a) or should use the native code functionality (for case b). Hope this helps - as far as I remember - the source code from the book-example is published on the web somewhere on his homepage. Greetings Karsten > > > If I open an image in a non-java program like Photoshop > and copy the image into clipboard, is there a way to have > my java program to read the clipboard content and fetch > the image data in the clipboard? > > Thanks in advance for your help, > > Terry > > __________________________________________________ > Do You Yahoo!? > Listen to your Yahoo! Mail messages from any phone. > http://phone.yahoo.com > > =========================================================================== > To unsubscribe, send email to [EMAIL PROTECTED] and include in the body > of the message "signoff JAVA2D-INTEREST". For general help, send email to > [EMAIL PROTECTED] and include in the body of the message "help". -- Karsten Trott Technical Lead, Intuitive Design Interface , Get2Chip.com, Inc. Staff R&D Engineer =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA2D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
