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 extends JFrame {

    public Main() {
        // Create a text area with some initial text
        JTextArea textarea = new JTextArea("Initial Text");

        int rows = 20;
        int cols = 30;
        textarea = new JTextArea("Initial Text", rows, cols);
        this.getContentPane().add(new JScrollPane(textarea));

    }

    public static void main(String[] args) {
        JFrame frame = new Main();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

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