Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

public class Main {

    public static void main(String argv[]) {
        JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        String testStr = "Paste text here.";
        JTextArea wrapArea = new JTextArea(testStr, 20, 40);
        wrapArea.setLineWrap(true);
        wrapArea.setWrapStyleWord(true);
        wrapArea.setCaretPosition(testStr.length());
        frame.add(new JScrollPane(wrapArea));
        frame.pack();
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
    }
}