import java.awt.*;
import javax.swing.*;
import javax.swing.text.*;

/**
 * An example that uses a text field
 *
 * @version 1.0
 * @author  Prof. David Bernstein, James Madison Univeristy
 */
public class TextFieldDriver
{

    /**
     * The entry point of the example
     *
     * @param args   The command line arguments
     */
    public static void main(String[] args)
    {
        Container     contentPane;
	JFrame   frame;
        JTextArea     textArea;
        JLabel        titleLabel;

        frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);       

	contentPane = frame.getContentPane();
	contentPane.setLayout(new BorderLayout());

	titleLabel = new JLabel();
	titleLabel.setText("A TextField Example");
	contentPane.add(titleLabel, BorderLayout.NORTH);

	textArea = new JTextArea();

	contentPane.add(textArea, BorderLayout.SOUTH);

        // Setup the observer
        TextFieldHandler handler = new TextFieldHandler();
        Document model = textArea.getDocument();
	model.addDocumentListener(handler);

        
	frame.setSize(400,200);
	frame.setVisible(true);
    }
}
