// (c) MIT 2003.  All rights reserved.

// -*-Mode: Java-*- 
// $Id: TextInputFrame.java,v 1.3 2003/03/06 00:40:40 moltmans Exp $
// TextInputFrame.java -- 
// Author: Michael Oltmans <moltmans@ai.mit.edu> 
// Created: <Fri Mar 10 12:24:21 2000> 
// Time-stamp: <2000-05-18 02:14:57 moltmans> 
package rec.speech;

import java.awt.*;
import java.awt.event.*;

public class TextInputFrame extends Frame 
{
  private TextField m_field;

  public TextInputFrame() 
  {
    super( "Text Input" );

    m_field = new TextField( 70 );
    ActionListener al = new ActionListener() {
      public void actionPerformed( ActionEvent e ) {
	RecListen.getListen().processString( e.getActionCommand() );
	m_field.setText( "" );
      }
    };

    m_field.addActionListener( al );

    Button button = new Button( "Send" );
    ActionListener bl = new ActionListener() {
      public void actionPerformed( ActionEvent e ) {
	RecListen.getListen().processString( m_field.getText() );
	m_field.setText( "" );
      }
    };
    button.addActionListener( bl );

    setLayout( new GridLayout(0,1) );
    add( new Label( "Enter the utterance:" ) );
    add( m_field );
    add( button );
  }

  public static void main( String[] argv ) 
  {
    TextInputFrame f = new TextInputFrame();
    f.setSize( 300, 50 );
    f.show();

    WindowListener wl = new WindowAdapter() {
      public void windowClosing( WindowEvent e ) {
	System.exit(0);
      }
    };

    f.addWindowListener( wl );
  }
}

  
      
