************************************************************************
COMPLETE SOURCE CODE FOR : AddJTextAreaIntoJFrame.java
************************************************************************
import javax.swing.JFrame;
import javax.swing.JTextArea;
import java.awt.GridLayout;
public class AddJTextAreaIntoJFrame
{
public static void main(String[]args)
{
//Create JTextArea without initial text
JTextArea textArea1=new JTextArea();
//Create JTextArea with initial text ( Text area with initial text )
JTextArea textArea2=new JTextArea("Text area with initial text");
//Create a JFrame with title ( Add JTextArea into JFrame )
JFrame frame=new JFrame("Add JTextArea into JFrame");
//Set JFrame layout
frame.setLayout(new GridLayout(2,1,1,5));
//Add first JTextArea into JFrame
frame.add(textArea1);
//Add second JTextArea into JFrame
frame.add(textArea2);
//Set default close operation for JFrame
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Set JFrame size
frame.setSize(400,500);
//Make JFrame visible. So we can see it.
frame.setVisible(true);
}
}
************************************************************************
JUST COMPILE AND EXECUTE IT
************************************************************************