T
tk
Hi Folks:
Any idea on the best approach to support copy/cut of all style/formatting as
well as plain text for a JTextPane? I googled quite a bit and located a
word processing program that supports JTextPane but they specifically
mention it only places "plain text" to the Clipboard and ignores the
formatting information when transfering.
I was thinking about implementing the Transferable interface and using the
Clipboard.setContents(..) method but I'm not sure yet by which procedure I
implement the getTransferData() as it wants to return an Object. I could
use a byte[] stream and return a ByteArrayOutputStream who's contents would
be filled with the Document's data (ie, plain text *and* the control/style
information). I just don't know if that would work yet but I plan to try
that.
Seems like there's very little (if anything) mentioned in the sun
developer's forum on how to do this as well as in google...
First of all, is Java's support for RTF still somewhat "primative"??? I
have a full blown word processor going which looks like Word and supports
font changes, size changes, find/replace operations, etc... It's just that
the cut/copy only transfers the plain text (despite my attempts to call
setContentType("text/rtf")) to the clipboard and not the style information.
thanks for any insight, Theron
Any idea on the best approach to support copy/cut of all style/formatting as
well as plain text for a JTextPane? I googled quite a bit and located a
word processing program that supports JTextPane but they specifically
mention it only places "plain text" to the Clipboard and ignores the
formatting information when transfering.
I was thinking about implementing the Transferable interface and using the
Clipboard.setContents(..) method but I'm not sure yet by which procedure I
implement the getTransferData() as it wants to return an Object. I could
use a byte[] stream and return a ByteArrayOutputStream who's contents would
be filled with the Document's data (ie, plain text *and* the control/style
information). I just don't know if that would work yet but I plan to try
that.
Seems like there's very little (if anything) mentioned in the sun
developer's forum on how to do this as well as in google...
First of all, is Java's support for RTF still somewhat "primative"??? I
have a full blown word processor going which looks like Word and supports
font changes, size changes, find/replace operations, etc... It's just that
the cut/copy only transfers the plain text (despite my attempts to call
setContentType("text/rtf")) to the clipboard and not the style information.
thanks for any insight, Theron