First figure out how do to this without a GUI, using Java I/O, then later use that same code as the "model" for your GUI. The Java tutorials will show you how to do the IO, and if you haven't studied them, I recommend that you give them a look.