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


import java.awt.*;

/**
 * This is a modification of the program from page 89-90 of 
 * "Late Night Advanced Java."  As written the program has a few
 * minor syntax errors, but the layout of the check boxes is incorrect
 * when run under SUN's Java 1.1.  It requires some more advanced uses
 * of layout to get a window that looks like the one on p. 89.  But
 * using only the border layout mgr and two additional panels, we
 * can get something roughly similar.  The two panels are used to 
 * group the buttons together on the overall frame.
 *
 * Note that this program uses the deprecated event handling mechanism from 
 * JDK 1.0.  Event handling has been substantially changed in JDK 1.1.
 */

public class searchWindow extends Frame
{
    public searchWindow()		// Constructor
    {
        Panel buttonPanel = new Panel();
        buttonPanel.setSize( 300,75 );
        Checkbox wholeWord = new Checkbox( "Match Whole Word" );
        Checkbox matchCase = new Checkbox( "Match Case" );
        buttonPanel.add( "West", wholeWord );
        buttonPanel.add( "East", matchCase );
        add( "Center", buttonPanel );
        
        Panel bGroup = new Panel();
        CheckboxGroup g = new CheckboxGroup();
        Checkbox all = new Checkbox( "All", g, true );
        Checkbox up = new Checkbox( "up", g, false );
        Checkbox down = new Checkbox( "Down", g, false );
        bGroup.add( "West", all );
        bGroup.add( "Center", up );
        bGroup.add( "East", down );

        add( "South", bGroup );
        
        TextField t = new TextField( "Input a word to search for here", 30 );
        add( "North", t );
    }

    public boolean handleEvent( Event e )
    {
        if ( e.id == Event.WINDOW_DESTROY )
        {
            System.exit( 0 );
        }
        return super.handleEvent( e );
    }

    public static void main( String[] arg )
    {
        Frame f = new searchWindow();
        f.list(System.out);			// Produces information that is helpful
        f.resize( 300,200 );			// for debugging.
        f.show();
    }
}
