I am trying to save the contents of a JFrame to a file so I can access in an event.
Any ideas?
Printable View
I am trying to save the contents of a JFrame to a file so I can access in an event.
Any ideas?
You can use the Serializable interface and the ObjectInputStream (Output) classes. Or you can simply use FileWriter to write String representations of your data to a file.
Either way try googling an IO tutorial.
I would take the information you want to save and print/write it to a text file.
The getUser() method being the return method which returns the values from the JFrame. You would have to do this for each variable/item individually though. Unless they are supposed to be in a group.Code:public void addUser() throws IOException
{
if (usern.equals(null))
usern = getUser();
NamesOutput.println(usern);
NamesOutput.close();
}
Like... DataOutput.println(usern +" "+ userj);