package aprendendojava;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
/**
 * Insert the type's description here.
 * Creation date: (5/18/01 3:06:54 PM)
 * @author: Rodrigo Alves Pereira.
 */
public class TextEntryBox extends javax.swing.JFrame {
/**
 * TextEntryBox constructor comment.
 */
public TextEntryBox() {
	super("TextEntryBox v1.0");
	setSize(200,300);
	setLocation(200,200);
	final JTextArea area =  new JTextArea();
	area.setFont(new Font ("Serif", Font.BOLD, 18));
	area.setText("Howdy!\n");
	final JTextField field = new JTextField();
	Container content = getContentPane();
	content.add(new JScrollPane(area), BorderLayout.CENTER);
	content.add(field,BorderLayout.SOUTH);
	setVisible(true);
	field.requestFocus();
	
	field.addActionListener(new ActionListener(){
		public void actionPerformed(ActionEvent e){
			area.append(field.getText()+"\n");
			field.setText("");			
		}
	}); 
		
}
/**
 * TextEntryBox constructor comment.
 * @param title java.lang.String
 */
public TextEntryBox(String title) {
	super(title);
}
	public static void main(String[] args){
		JFrame frame = new TextEntryBox();
		
		frame.addWindowListener(new WindowAdapter(){
			public void windowClosing(WindowEvent we){System.exit(0);}
		});

		frame.setVisible(true);
	}
}

