When you use the save functionallity of JFileChooser, you typically have to write your own save mehtod. There is no way for JFileChooser to know how to save every type of file. So when you click the save button, you just have to call a method that saves your text. So when you create a File file = new File("mydoc.rtf") is where you may add the extension of
rtf.
Now, as far as getting the format of an rtf document and saving that, I don't know. I don't think that simply doing a getText() on the TextPane and then grabbing each line and saving that to a file will save it as a true Rich Text Formatted file. Maybe someone else knows.