TextAreaElements.java Source code

Java tutorial

Introduction

Here is the source code for TextAreaElements.java

Source

/*
Core SWING Advanced Programming 
By Kim Topley
ISBN: 0 13 083292 8       
Publisher: Prentice Hall  
*/

import javax.swing.*;
import javax.swing.text.*;

public class TextAreaElements {
    public static void main(String[] args) {
        try {
            UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
        } catch (Exception evt) {
        }

        JFrame f = new JFrame("Text Area Elements");
        JTextArea ta = new JTextArea(5, 32);
        ta.setText("That's one small step for man...\nOne giant leap for mankind.");
        f.getContentPane().add(ta);
        f.pack();
        f.setVisible(true);

        ((AbstractDocument) ta.getDocument()).dump(System.out);
    }
}