If you want to use Rich Text Formatting you might want to use JTextPane. It handles that sort of things and a whole lot more.
As for saving the formatting information, you do have the option of using XML. This will require that you figure out/find an XML structure to handle that.
On the other hand, JTextPane implements the serializable interface. This interface allows a class to be put in a linear format so that it can be passed into an io stream and re-instantiated into a working object.
I'm not sure exactly how that works in code, as I have never actaully done it myself, but that would probably be the easiest way to do it.
In the API doc
it mentions that there will be compatibility issues from version to version and a better solution to take care of that.