import edu.uw.cline.TextAreaPrompt;
import edu.uw.cline.TextArea;
import java.awt.Frame;

/**
 * Example program that creates a TextAreaPrompt and then starts it. Type
 * exit to exit.
 */
public class TextAreaPromptExample {

	public static void main(String args[]) {

		// create the edu.uw.cline.TextArea with a minimum of 5 rows
		TextArea textArea = new TextArea(5);
		
		// create a Frame and add the TextArea
		Frame f = new Frame("TextAreaPrompt Example");
		f.add(textArea);
		f.setSize(600, 300);
		f.show();

		TextAreaPrompt prompt = new TextAreaPrompt("prompt", textArea);
		
		// test that the output streams have been redirected to the TextArea
		System.out.println("This message sent to standard output");
		System.err.println("This message sent to standard error");

		// register the QuestionCommand
		System.out.println("Registering the QuestionCommand");
		QuestionCommand questionCommand = new QuestionCommand();
		prompt.registerCommand(questionCommand);
		
		// start the prompt - the program will then wait for user-input
		System.out.println("Starting prompt...");
		prompt.start();
	}
}
