Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

public class Main {
    public static void main(String[] args) {
        String text = "one two three four five six seven eight nine ten ";
        JTextArea textArea = new JTextArea(text);
        textArea.setColumns(30);
        textArea.setLineWrap(true);
        textArea.setWrapStyleWord(true);
        textArea.append(text);
        textArea.append(text);
        textArea.append(text);
        textArea.append(text);
        textArea.append(text);
        textArea.setSize(textArea.getPreferredSize().width, 1);
        JOptionPane.showMessageDialog(null, new JScrollPane(textArea), "Not Truncated!",
                JOptionPane.WARNING_MESSAGE);
    }
}