i have used the following code to save the text in a textpane into a file
final RTFEditorKit kit = new RTFEditorKit();
jta.setEditorKit(kit);
jfr.setTitle(fname.getName());
OutputStream out = new FileOutputStream(fname);
kit.write(out,doc,0,doc.getLength());
out.close();
where jfr is the main frame,jta is the textpane,fname is the filename given by the user,doc is the styled document of the text pane...
my problem is that when i give the filename and click save button the text is stored in the file but the textpane is made empty..why is that happening..??