From 3301d00ab1df7a0f88985d143787f9f3c2283e38 Mon Sep 17 00:00:00 2001 From: jeff Date: Thu, 28 Aug 2014 10:43:48 -0400 Subject: added crash reporter --- src/cuchaz/enigma/gui/Gui.java | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'src/cuchaz/enigma/gui/Gui.java') diff --git a/src/cuchaz/enigma/gui/Gui.java b/src/cuchaz/enigma/gui/Gui.java index 3dcb4e2..e357382 100644 --- a/src/cuchaz/enigma/gui/Gui.java +++ b/src/cuchaz/enigma/gui/Gui.java @@ -28,6 +28,7 @@ import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.File; import java.io.IOException; +import java.lang.Thread.UncaughtExceptionHandler; import java.util.Collection; import java.util.Collections; import java.util.Comparator; @@ -176,6 +177,22 @@ public class Gui public Gui( ) { + // init frame + m_frame = new JFrame( Constants.Name ); + final Container pane = m_frame.getContentPane(); + pane.setLayout( new BorderLayout() ); + + // install a global exception handler to the event thread + CrashDialog.init( m_frame ); + Thread.setDefaultUncaughtExceptionHandler( new UncaughtExceptionHandler( ) + { + @Override + public void uncaughtException( Thread thread, Throwable ex ) + { + CrashDialog.show( ex ); + } + } ); + m_controller = new GuiController( this ); // init file choosers @@ -184,11 +201,6 @@ public class Gui m_exportFileChooser = new JFileChooser(); m_exportFileChooser.setFileSelectionMode( JFileChooser.DIRECTORIES_ONLY ); - // init frame - m_frame = new JFrame( Constants.Name ); - final Container pane = m_frame.getContentPane(); - pane.setLayout( new BorderLayout() ); - // init obfuscated classes list m_obfClasses = new JList(); m_obfClasses.setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); -- cgit v1.2.3