Re: Deleting contents of file



Gordon Beaton wrote:

When the user deletes the item from the JList, write the remaining
items to a new (temporary) file, delete the old file, then rename the
temporary file. By doing it this way you can avoid deleting the
original file if any errors occur while writing the temporary one.

Rather than deleting the old file, consider moving to a back-up file. Like filename + ".bak" or "~"+filename. That way, if you fugger it up, you still have the backup. ;)
.