File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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: 9189

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!