I have a program that reads from a database, and then displays the results in a TextArea. Then when the user hists upload the file will be saved to a .txt file, and then uploaded to the database. But currently I am getting the original which looks like this in the TextArea
1, Header,i
2, Item 1,n
3, Item 2,n
4, Item 3,n
to look like this in the file
1, Header,i2, Item 1,n3, Item 2,n4, Item 3,n
How can I resolve this issue_
Thanks for your help.
Here is my code that writes
try {
FileWriter w = new FileWriter ("upload.txt"); // save file to upload.txt
BufferedWriter out = new BufferedWriter (w);
out.write(ta.getText()); // ta is my textArea
out.close();
JOptionPane.showMessageDialog(null, "Kész!"); // tells the user that the save / upload has been completed.
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}