import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class TestTextArea extends JFrame implements ActionListener
{
private static final int FRAME_WIDTH = 400;
private static final int FRAME_HEIGHT = 200;
private static final int FRAME_X_ORIGIN = 150;
private static final int FRAME_Y_ORIGIN = 250;
private static final int BUTTON_WIDTH = 80;
private static final int BUTTON_HEIGHT = 30;
private JTextArea textArea;
private String str="";
public TestTextArea( )
{
setTitle("Sample Frame with Button Events");
setSize(FRAME_WIDTH, FRAME_HEIGHT);
setLocation(FRAME_X_ORIGIN, FRAME_Y_ORIGIN);
setResizable(false);
Container contentPane = getContentPane();
contentPane.setLayout(null);
contentPane.setBackground(Color.white);
textArea = new JTextArea();
textArea.setText("The quick brown fox...");
textArea.setEditable(true);
textArea.setLineWrap(true);
textArea.setWrapStyleWord(true);
contentPane.add(textArea);
JScrollPane scrollText = new JScrollPane(textArea);
scrollText.setBounds(50, 50, 300, 100);
scrollText.setBorder(BorderFactory.createLineBorder(Color.black));
contentPane.add(scrollText);
setDefaultCloseOperation(EXIT_ON_CLOSE);
}
public void actionPerformed(ActionEvent event)
{
}
public static void main(String[] args)
{
TestTextArea frame = new TestTextArea();
frame.setVisible(true);
frame.display();
}
public void display()
{
for(int i=0; i<1000; i++)
{
str = str + i + "\n";
textArea.setText(str);
}
}
}