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

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?

yes the problem is the line ..

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.