You have empty catch blocks, so you'll never know if there's been an error.
You also don't close your output stream, which means it's quite possible nothing gets written.
It should be closed in a finally block, or you should be using a try-with-resources:
It doesn't take 600 lines of code to test I/O. Test the I/O separately.
This is a general rule for writing code. You test small pieces of code to get them working then you add that functionality into the GUI.
Learn to simplify the code when learning something new. You NEVER need to write hundreds of lines of code to test/learn a concept.
The file writer writes to the binary dat file, and says it does, however if I go back to adding a new item, the old item is still in the fields, and it adds whatever I write over it in an increment of 1, so as long as my GUI stays open. Please help me understand what is going on here, and how I can fix it!
THE MAIN GUI
THE DISPLAY COLLECTION PANEL(READS FROM A FILE TO DISPLAY IN ONE OF THE PANELS AS WELL
THE ITEM PANEL
MY ITEM CLASS
The display doesnt show my new item until I exit and reopen my GUI.
if I go back to adding a new item, the old item is still in the fields, and it adds whatever I write over it in an increment of 1
You've explained what the program does. Can you also describe what you want it to do differently?
Note there is more code posted than most people are interested in copy for testing. Can you make a http://sscce.org/ for the problem?
Agree. As I said in your other thread, you should not be doing any File IO from a GUI. You should create classes which do the “business logic”, and those classes should be completely separate from the GUI. You should have them working nicely before you even think about the GUI. You should be able to write things like:-Once you have got that working, you can add the GUI. Also, you can write 40 lines of code and it is much easier to find errors in 40 lines than in the amount of code you provided.
Norm Radder wrote:. . . Note there is more code posted than most people are interested in copy for testing. . . .
I think this question is closely related to your other thread, so I shall join the two into one.