TextArea

ALT= "Applet could not be loaded" Sorry, it is time to upgrade your browser to a Java powered one.


import java.applet.Applet;
import java.awt.*;

public class MyTextArea extends Applet {
	private TextArea t1, t2;
	private Button b;

	public void init()
	{
		String s = "Welcome to CS335 - Web Programming\n" +
					"I hope that you are enjoying this semester\n" +
					" and are learning a lot...";
					
		t1 = new TextArea (5, 20);
		t1.setText (s);
		
		t2 = new TextArea (5, 20);
		
		b = new Button( "Copy >>>");

		setLayout (new FlowLayout(FlowLayout.LEFT, 5, 5) );

		add ( t1);
		add ( b);
		add ( t2);
	}
	public boolean action (Event e, Object o)
	{
		if (e.target == b)
		{
			t2.setText( t1.getSelectedText() );
			return true;
		}
		else
			return false;
	}
}