You can use java.lang.Thread.UncaughtExceptionHandler which catches all exceptions you haven't cared for yourself
import java.lang.Thread.UncaughtExceptionHandler; public class MyUncaughtExceptionHandler implements UncaughtExceptionHandler { public void uncaughtException(Thread t, Throwable e) { Frame.showError("Titel", "Description", e, Level.WARNING); e.printStackTrace(); } }
register it in your app:
public static void main(String[] args) { Thread.setDefaultUncaughtExceptionHandler(new MyUncaughtExceptionHandler()); }
and in your GUI you can use org.jdesktop.swingx.JXErrorPane from SwingX to show a nice error popup, which informs the user about exceptions.
public static void showError(String title, String desc, Throwable e, Level level) { JXErrorPane.showDialog(this, new ErrorInfo(title, desc, null, null, e, level, null)); }