Thursday, February 15, 2007

Paper Buildings Ho Scale

texo Save file

This example explains how to save a text file java, using the JFileChooser class to choose the name and directory file.


String Text = "Text you want to save";
try {/ / System.getProperty ("user.dir") Open the JFileChooser where is the executable fc.getSelectedFile = ();
if (Save! = null) {FileWriter
 Guardx = new FileWriter (Save); 
Guardx.write (Text);
Guardx.close () / / Close the file}


} catch (IOException ioe) {
System.out.println (ioe); / / Display the console errors

}



0 comments:

Post a Comment