This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
My scenario is this: I want to save the contents of a JTextArea to a file. If possible, I'd like to be able to have bold, italics, and underlined text in that JTextArea as well, and be able to save and restore it into my Java program. I'm not exactly sure the best way to do this. Serialization? XML Serialization? Or some other way I don't know about. Perhaps someone could point me in the right direction? And if you need more information as to what I'm trying to do, or why, let me know. Thanks, Sean
JTextArea just displays plain text. You use JEditorPane or JTextPane to display formatted text. They can also read plain text, HTML or RTF files, so take your pick as to the on-disk representation. They use a EditorKit to do the actual reading/writing.