I have a JTextPane
and on a ActionEvent
, I want to save the content of the JTextPane
(with the colors, text and other attributes) in another class (as a variable). Later on I want to exchange the content of the JTextPane
with the one of the variable.
I have tried to use:
(StyledDocument)myTextPane.getDocument()
and
myTextPane.getStyledDocument()
but both didn't work.
I thought about just give the whole JTextPane
over, but apperently the pane gets still updated in the other class...
EDIT: I would only use the content to show it (later) in the JTextPane
again. I won't be saving it in a file or something similar.