JTextAreaDemo.java Source code

Java tutorial

Introduction

Here is the source code for JTextAreaDemo.java

Source

/*
Java Internationalization
By Andy Deitsch, David Czarnecki
    
ISBN: 0-596-00019-7
O'Reilly
*/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class JTextAreaDemo extends JFrame {

    String davidMessage = "David says, \"\u05E9\u05DC\u05D5\u05DD \u05E2\u05D5\u05DC\u05DD\" \n";
    String andyMessage = "Andy also says, \"\u05E9\u05DC\u05D5\u05DD \u05E2\u05D5\u05DC\u05DD\"";

    public JTextAreaDemo() {
        super("JTextAreaDemo");
        GraphicsEnvironment.getLocalGraphicsEnvironment();
        Font font = new Font("LucidaSans", Font.PLAIN, 40);
        JTextArea textArea = new JTextArea(davidMessage + andyMessage);
        textArea.setFont(font);
        this.getContentPane().add(textArea);
        textArea.show();
    }

    public static void main(String[] args) {
        JFrame frame = new JTextAreaDemo();
        frame.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }
        });

        frame.pack();
        frame.setVisible(true);
    }
}