View Single Post
  #2 (permalink)  
Old 12-06-2007, 02:54 AM
hardwired hardwired is offline
Senior Member
 
Join Date: Jul 2007
Posts: 1,222
hardwired is on a distinguished road
Code:
JTextField phoneJTextField = new JTextField("Beachwood 45789"); JTextField postcodeJTextField = new JTextField("99231"); Writer fw = null; try { fw = new FileWriter( "customer.txt" ); String phoneNumber = phoneJTextField.getText(); String postalCode = postcodeJTextField.getText(); fw.write( phoneNumber + "," + postalCode ); } catch ( IOException e ) { System.err.println( "Cannot write to file" ); } finally { if ( fw != null ) try { fw.close(); } catch ( IOException e ) { System.out.println("Close error: " + e.getMessage()); } }
Reply With Quote