[英]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: 您需要使用自定义的Transferable对象:
http://www.coderanch.com/t/345580/GUI/java/Cut-copying-pasting-custom-object http://www.coderanch.com/t/345580/GUI/java/Cut-copying-pasting-custom-object
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.