0

I have designed a GUI with JLabels, JTextFields and 4 JButtons. One of my buttons when clicked should take what the user has typed into all of the text fields and save them into a plain text file to then be able to be read by the same GUI.

I have already set up the action listeners for the buttons but cannot figure out how to write the code to copy the text from all of the text fields into a file. Can anyone help?

Thanks

  • 1
    What actually you can not figure out? How to read text from text fields or how to write to the file? – Ostap Maliuvanchuk May 26 '14 at 16:24
  • It's a bit of both to be honest. I need a code to take the contents of all of my texts fields at once and copy the information into a plaintext file. Sorry if im not very specific, i'm very new to java. – FutureKarlos May 26 '14 at 16:27

1 Answers1

0

Here is how read from textField How to Retrieve value from JTextField in Java Swing?

Here is how to write String to file http://www.mkyong.com/java/how-to-write-to-file-in-java-fileoutputstream-example/

But it's all very googlable, so next time try to search it by yourself, that is one programmer responsibilities.

Community
  • 1
  • 1
Ostap Maliuvanchuk
  • 1,125
  • 2
  • 12
  • 32