I have this file that I'm using to display users from a mysql database. I have a couple problems with it though. 1)When I open it, it opens the first window fine, but when I close it another random empty window opens. 2) I can't seem to get it to save changes to the database. What am I doing wrong?
It's possible that your SQL code is throwing exceptions, and that's why no updates are happening. Right now you just let the internal Swing code (the code which is calling the code you wrote) deal with those exceptions, and usually what it does is to just write the stack trace to the system console and carry on. However when you run a Swing app in the usual way, you can't see the console and so you can't tell whether exceptions are happening or not.
I'd suggest looking for that possibility to start with. Either deal with the exception in your code in some way (e.g. pop up a dialog box) or run the Swing app in an environment where you can see the console.
There might be a different reason why the updates aren't happening (there are several possibilities) but start with squashing the exceptions first.
posted 2 years ago
I thought I was printing all the errors to the console. Should I just add a System.out.println("It broke here") to a bunch of spots?