JTextArea is section of the JTextComponent. It includes the component named as JTextArea. The JTextArea component is used to display plain text and is a multi-line textarea. It is known as lightweight component for working with text.
Example...
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class TextAreaa extends JApplet implements ActionListener
{
Container Panel;
JTextField Sample;
JTextArea e1,e2;
LayoutManager Layout;
public TextAreaa()
{
Sample=new JTextField("Sample",20);
e1=new JTextArea(5,20);
e2=new JTextArea(5,20);
Layout=new FlowLayout();
Panel=getContentPane();
Sample.addActionListener(this);
e1.setEditable(false);
e1.setBackground(Color.white);
e1.setLineWrap(true);
Panel.setLayout(Layout);
Panel.add(Sample);
Panel.add(e1);
Panel.add(e2);
Panel.setBackground(Color.pink);
}
public void actionPerformed(ActionEvent actionevnt)
{
String Reply;
Reply="text entered"+Sample.getText();
e1.setText(Reply);
Reply="text entered"+Sample.getText();
e2.setText(Reply);
}
}
//<applet code="TextAreaa.class" width=250 height=250></applet>