Global exception handler for user interface thread
Posted on 2003-03-28
I want to write a global exception handler for the main Java UI thread.
Something that traps any exceptions that weren't handled
at a lower level and pops up a message box and then allows the application
It's that last part (about the app continuing) which presents the problem for me.
Otherwise I could simply put the try...catch in main(). That would report the
problem, but wouldn't allow the app to continue.
I see that ThreadGroup has an uncaughtException() method, but I can't see any
way to make use of this as I don't explicitly create the UI thread...so I don't
see how to subclass and replace this method and even if I could I'm not sure
it would solve the problem.
In case it matters, my app's main window is a JFrame.
Thanks in advance for any help,