ClipboardUtils - easily copy text and images (also combined as rtf)
From: Meikel (m.bisping_at_gmx.de)
Date: 03/21/04
- Next message: Yoyoma_2: "UML diagrams"
- Previous message: Meikel: "Re: How to implement DropTarget.DropTargetAutoScroller ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 21 Mar 2004 08:58:40 -0800
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)
- Next message: Yoyoma_2: "UML diagrams"
- Previous message: Meikel: "Re: How to implement DropTarget.DropTargetAutoScroller ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|