Hey,
Im working on a programme and need it to write to file. I put in a file writer it seems to run ok, creates the txt file but doesnt write any data. Heres the code:
private void requestJButtonA ctionPerformed (ActionEvent event)
{
Writer fw = null;
try
{
//fw = new FileWriter( "customer.t xt" );
final FileWriter outputFile = new FileWriter("cus tomer.txt");
final BufferedWriter outputBuffer = new BufferedWriter( outputFile);
final PrintWriter printstream = new PrintWriter(out putBuffer);
fw.write( phoneJTextField + "," + postcodeJTextFi eld );
}
catch ( IOException e ) {
System.err.prin tln( "Cannot write to file" );
}
finally {
if ( fw != null )
try { fw.close(); } catch ( IOException e ) { }
}
}
any ideas then please help!
Thanks
Nicole
Im working on a programme and need it to write to file. I put in a file writer it seems to run ok, creates the txt file but doesnt write any data. Heres the code:
private void requestJButtonA ctionPerformed (ActionEvent event)
{
Writer fw = null;
try
{
//fw = new FileWriter( "customer.t xt" );
final FileWriter outputFile = new FileWriter("cus tomer.txt");
final BufferedWriter outputBuffer = new BufferedWriter( outputFile);
final PrintWriter printstream = new PrintWriter(out putBuffer);
fw.write( phoneJTextField + "," + postcodeJTextFi eld );
}
catch ( IOException e ) {
System.err.prin tln( "Cannot write to file" );
}
finally {
if ( fw != null )
try { fw.close(); } catch ( IOException e ) { }
}
}
any ideas then please help!
Thanks
Nicole
Comment