I'm making a game in Java using the Swing API, and since it's (A) my first game and (B) very early in development, I feel it would be helpful if users could send in crash reports such that I can track down bugs. I've already coded a simple crash screen which takes any exception in its constructor and generates a report with system information and the stack trace. However, I can't seem to find a way to detect fatal errors when they occur.
I tried wrapping the game loop in a try/catch, with the catch leading to the crash screen, but that doesn't help with errors that come from other parts of the program, for example methods triggered by mousePressed() or that are part of the rendering (update(), repaint(), paint(), etc.) family. What I'm wondering is if there's a way to detect when the game is unable to continue, and automatically close the main window and display the error report.
Any suggestions are much appreciated.