0

hi
im not very good in english .. XD
im trying to make a simple text editor that can open and save..

i have a problem in my save code
here is the code:

JFileChooser jfc = new JFileChooser();
        jfc.showSaveDialog(jMenuItem1);

        File f = jfc.getSelectedFile();
        try {

            FileWriter fr = new FileWriter(f);
            BufferedWriter bw = new BufferedWriter(fr);

            String line = "";


                     bw.write(jTextArea1.getText());

                     bw.flush();
                     jTextArea1.append(line);
                     jTextArea1.append("\n");


                     bw.close();
        }catch (Exception e) {
            System.err.println(e);
            System.exit(1);
        }

it can already save
the problem is that when i input:

sample

output

the output is

sampleoutput
2
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by NormR1
0

Can you make a small complete programn that compiles, executes and shows the problem?

Is the problem with the output that it is missing the line end characters?

Edited by NormR1

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.