/*
 * authorDialog.java    97/06/26
 *
 * Modifications by BFC
 */


import java.awt.*;

/**
 * This is the program from pages 93-4 of "Late Night Advanced Java."
 * It demonstrates how to pop up and dismiss a dialog box.
 *
 * Note that it uses the deprecated event handling mechanism from 
 * JDK 1.0.  Event handling has been substantially changed in JDK 1.1.
 *
 * I had to make quite a few changes to get this program to compile
 * and execute under Unix.  I also tried it under Microsoft's J++; 
 * it required fewer modifications in that environment, clearly the
 * one that the author was using.
 */

public class authorDialog extends Dialog
{
    public authorDialog( Frame parent )		// Constructor
    {
        super( parent, "Author Information", false );
        System.out.println( "authorDialog.authorDialog:" );
        setSize( 300,200 );			// Set size of dialog box.  Seems necessary
        add( "Center", 				// to get box to display.
              new Label( "Here's my first dialog box" ) );
        
        add( "South", new Button( "Done" ) );
    }

    public boolean action( Event e, Object arg )
    {
        System.out.println( "authorDialog.action: e = " + e );
        if ( e.target instanceof Button )
        {
            this.hide();			// Hide and dispose of the dialog box.
            this.dispose();
            return true;
        }
        return super.action( e,arg );
    }

    public static void main( String[] arg )
    {
        Frame f = new Frame( "Main Frame" );
        f.resize( 300,200 );			// This is a deprecated method.  Should use
        f.show();				// it's renamed version called setSize().
        authorDialog ad = new authorDialog( f );
        ad.show();
    }
}
