saveing to afile

how can i save the content of a textfeild to a file.txt?
[63 byte] By [student14a] at [2007-11-27 2:37:04]
# 1

import the IO package in ur file like

import java.IO.*

try{

PrintWriter out = new PrintWriter(new FileWriter("temp.txt"));

// Write text to file

out.println(textField.getText());

out.close();

}catch(IOException ex){

new ExceptionHandler("Error while writing to temp.txt file",ex);

}

enjoy...

Bnahirraoa at 2007-7-12 2:56:56 > top of Java-index,Java Essentials,New To Java...
# 2
yes it works well,but now i want to open a file and write its content to a textArea,,i try the previous code but the IO exception is thrown? so what is the problem?
student14a at 2007-7-12 2:56:56 > top of Java-index,Java Essentials,New To Java...