By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,871 Members | 2,575 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,871 IT Pros & Developers. It's quick & easy.

ClipboardUtils - easily copy text and images (also combined as rtf)

P: n/a
I created a ClipboardUtils class which makes it easy to copy Strings
or images to the clipboard.
I don't claim that it's no way perfect, but has been useful in my
applications so far. If you try it out and have improvement
suggestions, let me know.
It can also copy a graphical image of any JComponent to the clipboard.

I also wondered how I could copy text AND images to the clipboard at
the same time (e.g. an image with some explanatory text below). Just
creating a Transferable which supports stringDataFlavor and
imageDataFlavor isn't enough.
I realised that one way to do it, is to create a rtf (RichTextFormat)
document.
(This can be done nicely with iText or manually according to the
rtf-specification).
I also wrote a little sample application which places an rtf into the
clipboard (it needs itext.jar from www.lowagie.com/itext)
The ClipboardUtils-class together with a little sample application can
be found at
http://www.mbisping.de/java/ClipboardUtils.zip (14K)
Jul 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.