package org.bdgp.MMSlide;

import java.io.PrintWriter;
import java.io.StringWriter;
import java.lang.reflect.InvocationTargetException;

import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;

public class Main {
    public static void main(String[] args) throws InvocationTargetException, InterruptedException {
        // try to set look and feel on Linux OS
        if (System.getProperty("os.name").equals("Linux")) {
            try {
//                UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
                UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel");
            } catch (Exception e) {}
        }
        
        // open the slide workflow dialog
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                final WorkflowDialog dialog = new WorkflowDialog();
                dialog.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                dialog.pack();
                dialog.setVisible(true);
                
                Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
                    public void uncaughtException(Thread t, Throwable e) {
                        StringWriter sw = new StringWriter();
                        PrintWriter pw = new PrintWriter(sw);
                        e.printStackTrace(pw);
                        System.err.println(sw.toString());
                        
                        JOptionPane.showMessageDialog(dialog, sw.toString());
                        dialog.dispose();
                    }
                });
            }
        });
    }
}

@@ -189,16 +189,46 @@
 onPane;%0A
+import javax.swing.JTextArea;%0A
 import j
@@ -535,26 +535,8 @@
 ry %7B
-%0A//               
  UIM
@@ -562,20 +562,13 @@
 el(%22
-com.sun.
 java
+x
 .swi
@@ -579,15 +579,21 @@
 laf.
-gtk.GTK
+nimbus.Nimbus
 Look
@@ -594,32 +594,57 @@
 usLookAndFeel%22);
+ %7D catch (Exception e) %7B%7D
 %0A               
@@ -640,19 +640,21 @@
         
-   
+try %7B
  UIManag
@@ -664,37 +664,44 @@
 setLookAndFeel(%22
+com.sun.
 java
-x
 .swing.plaf.nimb
@@ -692,37 +692,31 @@
 .swing.plaf.
-nimbus.Nimbus
+gtk.GTK
 LookAndFeel%22
@@ -717,28 +717,16 @@
 dFeel%22);
-%0A           
  %7D catch
@@ -1536,32 +1536,152 @@
                %0A
+                        JTextArea text = new JTextArea(sw.toString());%0A                        text.setEditable(false);%0A
                 
@@ -1726,29 +1726,20 @@
 dialog, 
-sw.toString()
+text
 );%0A     

fix error reporting