JTextPane, JEditorPane, copy & paste etc.

W

wizofaus

I've been playing around with JTextPane and JEditorPane and found a few
odd things. At least under Windows and Java 1.5, neither JTextPane or
JEditorPane support copying & pasting of formatted text very well. The
former doesn't support it at all (even inside the control), and the
latter doesn't support it when interacting with other standard Windows
controls. I can, if necessary, live without the latter, but the former
is definitely needed.
But while it seems quite easy to put together a simple app that lets
you change the text display style (font, color etc.) for new and
existing (selected) text in a JTextPane, it's not so obvious how to do
this for a JEditorPane. Furthermore, for JTextPane, serializing via the
XMLEncoder, as recommended by the Sun documentation, does not capture
all the style information.

Can anyone recommend perhaps a better third-party rich text editing
control that would support all the functionality I'm looking for?
 
W

wizofaus

I've been playing around with JTextPane and JEditorPane and found a few
odd things. At least under Windows and Java 1.5, neither JTextPane or
JEditorPane support copying & pasting of formatted text very well. The
former doesn't support it at all (even inside the control), and the
latter doesn't support it when interacting with other standard Windows
controls. I can, if necessary, live without the latter, but the former
is definitely needed.
But while it seems quite easy to put together a simple app that lets
you change the text display style (font, color etc.) for new and
existing (selected) text in a JTextPane, it's not so obvious how to do
this for a JEditorPane. Furthermore, for JTextPane, serializing via the
XMLEncoder, as recommended by the Sun documentation, does not capture
all the style information.

Can anyone recommend perhaps a better third-party rich text editing
control that would support all the functionality I'm looking for?

After playing around a bit more, I'm reasonably happy JEditorPane can
do most of what I want. I still want a method of importing exist
formatted text from other applications, and copy & paste would be
ideal, but I suppose I'll have to look for alternative solutions.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top