how can i implement a string from Jtextfield and saving it to a file

Reply

Join Date: Oct 2004
Posts: 26
Reputation: SyLk is an unknown quantity at this point 
Solved Threads: 0
SyLk SyLk is offline Offline
Light Poster

how can i implement a string from Jtextfield and saving it to a file

 
0
  #1
May 3rd, 2005
can someone explain to me how i can go about implementing a string from a jtextfield and storing it to a file please. I would really appreciate some sample code on this one. Thank you
Reply With Quote Quick reply to this message  
Join Date: Mar 2004
Posts: 763
Reputation: Phaelax is on a distinguished road 
Solved Threads: 38
Phaelax Phaelax is offline Offline
Master Poster

Re: how can i implement a string from Jtextfield and saving it to a file

 
0
  #2
May 4th, 2005
  1. try
  2. {
  3. PrintWriter out = new PrintWriter(new FileOutputStream(new File(filename)));
  4. String text = myTextField.getText();
  5. out.print(text);
  6. out.close()
  7. }
  8. catch(Exception e)
  9. {System.out.println(e);}
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC