/*
 * JaamSim Discrete Event Simulation
 * Copyright (C) 2003-2011 Ausenco Engineering Canada Inc.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */
package com.sandwell.JavaSimulation3D;

import com.jaamsim.input.InputAgent;

/**
 * Implements a graphic interface to display Exceptions to the user
 */
public class ExceptionBox extends javax.swing.JDialog {

	public ExceptionBox( Throwable e ) {
		this( e, true );
	}

	public ExceptionBox( Throwable e, boolean stackTraceFlag ) {
		super();

		// display debugging information to the developer in the command screen
		if( stackTraceFlag ) {
			e.printStackTrace();
		}

		InputAgent.doError(e);

		//setup the dialog
		setTitle( "TERMINAL ERROR" );
		//setModal( true );
		setDefaultCloseOperation( javax.swing.JDialog.DISPOSE_ON_CLOSE );

		// setup the error mesage area
		javax.swing.JTextArea txt = new javax.swing.JTextArea();
		txt.setText( "An error occurred in the simulation environment.  Please check inputs for an error:\r\n" + e );
		//txt.append( "\r\n\r\nClick OK to Terminate the Application" );
		txt.setMargin( new java.awt.Insets( 10, 10, 10, 10 ) );
		txt.setLineWrap( true );
		txt.setWrapStyleWord( true );
		getContentPane().add( txt );

		// setup the OK button
		javax.swing.JButton okButton = new javax.swing.JButton( "OK" );
		okButton.addActionListener( new java.awt.event.ActionListener() {

			@Override
			public void actionPerformed( java.awt.event.ActionEvent ae ) {
				ExceptionBox.this.dispose();

			}
		} );
		getContentPane().add( okButton, java.awt.BorderLayout.SOUTH );

		// set size and display
		setSize( 400, 200 );
		setVisible( true );
	}
}

@@ -640,16 +640,90 @@
 ion3D;%0A%0A
+import java.awt.event.ActionEvent;%0Aimport java.awt.event.ActionListener;%0A%0A
 import c
@@ -882,16 +882,41 @@
 JDialog 
+implements ActionListener
 %7B%0A%0A%09publ
@@ -1887,170 +1887,12 @@
 ner(
- new java.awt.event.ActionListener() %7B%0A%0A%09%09%09@Override%0A%09%09%09public void actionPerformed( java.awt.event.ActionEvent ae ) %7B%0A%09%09%09%09ExceptionBox.this.dispose();%0A%0A%09%09%09%7D%0A%09%09%7D 
+this
 );%0A%09
@@ -1913,17 +1913,16 @@
 e().add(
- 
 okButton
@@ -1950,17 +1950,16 @@
 ut.SOUTH
- 
 );%0A%0A%09%09//
@@ -2027,11 +2027,90 @@
 ue );%0A%09%7D
+%0A%0A%09@Override%0A%09public void actionPerformed(ActionEvent e) %7B%0A%09%09this.dispose();%0A%09%7D
 %0A%7D%0A

implement ActionListener rather than providing an anonymous inner class