简体   繁体   English

如何使用Java将图像和文本复制到剪贴板?

[英]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);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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