import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class TextAreaSample extends JFrame implements ActionListener
{
private static final int FRAME_WIDTH = 800;
private static final int FRAME_HEIGHT = 600;
private static final int FRAME_X_ORIGIN = 200;
private static final int FRAME_Y_ORIGIN = 100;
private static final int BUTTON_WIDTH = 80;
private static final int BUTTON_HEIGHT = 30;
private JTextArea textArea;
public TextAreaSample(String str)
{
setTitle("Text Area Sample");
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(str);
textArea.setEditable(false);
textArea.setLineWrap(true);
textArea.setWrapStyleWord(true);
contentPane.add(textArea);
JScrollPane scrollText = new JScrollPane(textArea);
scrollText.setBounds(10, 10, 780, 560);
scrollText.setBorder(BorderFactory.createLineBorder(Color.black));
contentPane.add(scrollText);
setDefaultCloseOperation(EXIT_ON_CLOSE);
}
public void actionPerformed(ActionEvent event)
{
}
public static void main(String[] args)
{
TextAreaSample frame = new TextAreaSample("testing...");
frame.setVisible(true);
}
}