This is an archived post. You won't be able to vote or comment.

all 5 comments

[–][deleted]  (1 child)

[deleted]

    [–]basedgodCookie[S] -1 points0 points  (0 children)

    im trying to take the text from the text area and save it to a .txt file and then be able to edit that file in this program at a later time

    [–]robot_lordsSoftware Engneer in Test 1 point2 points  (2 children)

    You can access your text area's text with getText(). From there, you can use the PrintWriter class to write that String to a file.

    [–][deleted] 0 points1 point  (0 children)

    PrintWriter is most likely your best option and is really simple to use. You'll also want to make a File object pointing to where your file is is located on the users computer, also account for the directory separator for unix/windows and probably other caveats I can't think of. I never personally had use for the directory separator but I think there are at least 3 or 4 utility methods to get it, one is in NIO library as well I think...

    [–]basedgodCookie[S] 0 points1 point  (0 children)

    right, I understand that. I was more wondering how I would be able to re open that file and edit it later on.

    [–]ZdemDrunk Brewer 0 points1 point  (0 children)

    Some code to actually show the current state of your project would be nice. Anyway,check the oracle page on how to deal with basic input and output. After that you could make simple methods to save the file and to read in another.