I'm a relative newbie to Java, but I'm working on a project. I want to take the input from a Java GUI and store it in a text file. I also want to be able to take that same file and read it back to the GUI. The idea here is to, say, store a customer's purchases in a single file, and allow the user to view a particular customer's purchases. Let's say the input looks like this:
John 3-18-2012 Hammer
Bill 3-14-2012 Nail
John 2-8-2012 Broom
Randy 2-5-2012 Rake
I want the user to be able to pull up all of John's(or whoever) purchases. I also want to be able to add records to this file in case Randy ever comes back and buys something else.
I'm thinking that sorting the data according to the customer as it comes in would make it quicker in searching for the correct customer later. I'd like to load the file upon opening the "recordManageme nt" class, and an array needs to be in there somewhere.
I'm pretty sure I'm looking at FileWriter, BufferedWriter, PrintWriter, BufferedReader, and/or FileReader.
But, even looking at examples, I've having trouble even figuring out where to start for my particular project. Any help would be appreciated.
John 3-18-2012 Hammer
Bill 3-14-2012 Nail
John 2-8-2012 Broom
Randy 2-5-2012 Rake
I want the user to be able to pull up all of John's(or whoever) purchases. I also want to be able to add records to this file in case Randy ever comes back and buys something else.
I'm thinking that sorting the data according to the customer as it comes in would make it quicker in searching for the correct customer later. I'd like to load the file upon opening the "recordManageme nt" class, and an array needs to be in there somewhere.
I'm pretty sure I'm looking at FileWriter, BufferedWriter, PrintWriter, BufferedReader, and/or FileReader.
But, even looking at examples, I've having trouble even figuring out where to start for my particular project. Any help would be appreciated.
Comment