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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Meikel

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

    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 stringDataFlavo r 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)
Working...