GavinEllis
Programmer
Gday,
I have a JTextarea called textArea and when i load my program it displays the text from a file called letters.txt
Now when I change any of the text it saves it back to that file, here is my save button function
addButton (toolBar, "Save", new ActionListener()
{ public void actionPerformed(ActionEvent evt)
{ // System.out.println(textArea.getText());
out.print(textArea.getText());
}
});
Now If "Example" comes up in the textArea and I modify it to say "Test". After I click save letters.txt will say "ExameplTest". I would like the textArea to save only whatever is in the textArea. I was just trying to find out if I could delete everything in letters.txt after it has loaded it into the text area. Anyone know the commands?
Gavin
I have a JTextarea called textArea and when i load my program it displays the text from a file called letters.txt
Now when I change any of the text it saves it back to that file, here is my save button function
addButton (toolBar, "Save", new ActionListener()
{ public void actionPerformed(ActionEvent evt)
{ // System.out.println(textArea.getText());
out.print(textArea.getText());
}
});
Now If "Example" comes up in the textArea and I modify it to say "Test". After I click save letters.txt will say "ExameplTest". I would like the textArea to save only whatever is in the textArea. I was just trying to find out if I could delete everything in letters.txt after it has loaded it into the text area. Anyone know the commands?
Gavin