954,536 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

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

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

SyLk
Light Poster
27 posts since Oct 2004
Reputation Points: 10
Solved Threads: 0
 
try
{
	PrintWriter out = new PrintWriter(new FileOutputStream(new File(filename)));
	String text = myTextField.getText();
	out.print(text);
	out.close()
}
catch(Exception e)
{System.out.println(e);}
Phaelax
Practically a Posting Shark
858 posts since Mar 2004
Reputation Points: 92
Solved Threads: 51
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You