This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes I/O and Streams and the fly likes data saving question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "data saving question" Watch "data saving question" New topic

data saving question

Code Monk

Joined: Apr 25, 2003
Posts: 5
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.
Joe Ess

Joined: Oct 29, 2001
Posts: 9168

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.

[How To Ask Questions On JavaRanch]
I agree. Here's the link:
subject: data saving question
It's not a secret anymore!