Problem in Detail: Saving: JTextPane saves data to a test file ("testfile.txt"). Doesn't information such as italics, bold, and size.
Problem in Detail: Attributes handling:
When you click to another area in the JTextPane (called "area"), the buttons are off. When you click one of the Attributes buttons while not at the end, it takes the attributes from the end and places them in the spot where you are typing.
What am I doing wrong and how do I fix them?
John Price aka cc11rocks
EDIT: Should I use a caret listener to fix the attributes problem?
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” (Mosher's Law of Software Engineering)
“If debugging is the process of removing bugs, then programming must be the process of putting them in.” (Edsger Dijkstra)
The API documentation for the "write" method of JTextPane says:
Stores the contents of the model into the given stream. By default this will store the model as plain text.
So you can't use that. You're going to have to serialize the Document which underlies the text component yourself. I don't know if there's a standard way to do that, but when I had to do it I serialized it as XML (I made up my own XML format for that).