FileDocCategorySizeDatePackage
Main.javaAPI DocExample2363Thu May 05 05:37:12 BST 2005com.samscdrental.display

Main

public class Main extends Object

Title: Sams CD Rental Store

Description:

Copyright: Copyright (c) 2004

Company:

author
Ken Pugh
version
1.0

Fields Summary
private static final String
TERMINATION_MESSAGE_HEADER
private static final String
TERMINATION_MESSAGE_TITLE
private static final String
UNEXCEPTED_TERMINATION_MESSAGE_TITLE
private static final String
STACK_TRACE_MESSAGE_TITLE
Constructors Summary
Methods Summary
private static voiddisplayStackTrace(java.lang.Throwable exception)

		String errorString = getStackAsString( exception );
		JOptionPane.showMessageDialog( null,
									   errorString,
									   STACK_TRACE_MESSAGE_TITLE,
									   JOptionPane.ERROR_MESSAGE );

	
private static java.lang.StringgetStackAsString(java.lang.Throwable exception)

		StringBuffer stringBuffer = new StringBuffer();
		StackTraceElement[] ste = exception.getStackTrace();
		for ( int i = 0; i < ste.length; i++ )
		{
			stringBuffer.append( ste[i].toString() +
								 System.getProperty( "line.separator" ) );
		}
		return stringBuffer.toString();

	
public static voidmain(java.lang.String[] args)

		try
		{
			RentalOperations.getInstance();
			MainFrame mainFrame = new MainFrame();
			mainFrame.setBounds( 10, 10, 400, 400 );
			mainFrame.show();
		}
		catch ( SeriousErrorException exception )
		{
			JOptionPane.showMessageDialog( null,
										   TERMINATION_MESSAGE_HEADER +
										   exception.getMessage(),
										   TERMINATION_MESSAGE_TITLE,
										   JOptionPane.ERROR_MESSAGE );
			displayStackTrace( exception );
			Throwable imbeddedException =
				exception.getCause();
			displayStackTrace( imbeddedException );
		}
		catch ( Exception exception )
		{

			JOptionPane.showMessageDialog( null,
										   TERMINATION_MESSAGE_HEADER +
										   exception.getMessage(),
										   UNEXCEPTED_TERMINATION_MESSAGE_TITLE,
										   JOptionPane.ERROR_MESSAGE );
			displayStackTrace( exception );
		}