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.JTable;

public class Main extends JFrame {

    public Main() {
        setSize(600, 300);
        String[] columnNames = { "A", "B", "C" };
        Object[][] data = { { "M", "a", 2 }, { "J", "e", 4 }, { "M", "z", 6 } };

        JTable table = new JTable(data, columnNames);
        JScrollPane tableSP = new JScrollPane(table);

        add(tableSP);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
    }

    public static void main(String[] args) {
        new Main().setVisible(true);

    }
}