Results 1 to 3 of 3
  1. #1
    jogendar is offline Member
    Join Date
    Jan 2010
    Posts
    13
    Rep Power
    0

    Default problem in saving file

    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..??

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    Here's where an SSCCE would help us to much better understand just what is not working. Please have a look at the link and consider posting one. Best of luck!

  3. #3
    senorbum is offline Member
    Join Date
    Aug 2009
    Posts
    76
    Rep Power
    0

    Default

    Quote Originally Posted by Fubarable View Post
    Here's where an SSCCE would help us to much better understand just what is not working. Please have a look at the link and consider posting one. Best of luck!
    Thank you for this link, I shall use it in the future :)

Similar Threads

  1. Problem Saving a file
    By GraemeH in forum New To Java
    Replies: 1
    Last Post: 04-09-2009, 01:14 AM
  2. Saving ArrayList to File
    By nwboy74 in forum Advanced Java
    Replies: 6
    Last Post: 12-08-2008, 11:19 AM
  3. Saving to a Text File
    By jadaleus in forum Advanced Java
    Replies: 2
    Last Post: 10-17-2008, 07:50 PM
  4. Saving data in an XML file
    By Thez in forum New To Java
    Replies: 1
    Last Post: 12-08-2007, 10:24 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •