简体   繁体   中英

how to copy image and text to clipboard using Java?

i want to copy image and text together to clipboard at same time but i can copy image or text

//class to copy text
    StringSelection selection=new StringSelection(text);

 c.setContents(selection, null);
//class to copy image
                   ImageTransferable s=new ImageTransferable(image);


                       c.setContents(s, null);

You'll need to use a custom Transferable object:

http://www.coderanch.com/t/345580/GUI/java/Cut-copying-pasting-custom-object

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM