Today I had a look at files and therefore I’d like to create a GUI application that allows me to type a sentence or a word and store it to a text file. The reason for this is that, when I come across an interesting word or sentence I like to keep it somewhere for future reference, which means that the new word/sentence needs to be appended at the end of the file, without overwriting anything. It should also allow for multiple languages, but I don’t see that being a problem.
Following from other applications I developed, and the advices kindly given, I’ll leave the GUI as a last thing (will do it with GridBagLayout of course), so I’ll first create an application that takes a sentence/word as a hardcoded string.
The way I envisage this, providing you guys think it is a good idea, is to have a JTextArea that takes the sentence and then an action button (Save) that will allow the application to save the input to a text file.
I’ve read a bit about Sequential-access text files and object serialization. I’m a bit torn between one and the other, and here is why: I don’t really need to amend the sentence/words I write, the idea is that, I write them to file and they are there for when I want to open the file and take a look at them, but then again, what happens if I make a mistake, misspell a word and so on? Wouldn’t I need to amend it?
My understanding is that with sequential access you can’t amend things, you can only re-write the whole file whereas with object serialization you can.
So, what do you guys suggest? Do you have any advice as to how to build it?