I was trying to make a simple Spreadsheet java app. For this I am using JTable in swing. My code is as follows:
import javax.swing.*;
import java.awt.*;
public class Main {
    private JFrame Frame;
    public Font f = new Font("Candara", Font.PLAIN, 14);
    public JFileChooser choicer = new JFileChooser();
    public String dir;
    private JTable Table;
    public String[] columns;
    public String[][] data = new String[10][2];
    public static Main m = new Main();
    /**
     * Launch the application.
     */
    public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                try {
                    m.Frame.setVisible(true);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }
    /**
     * Create the application.
     */
    public Main() {
        initialize();
    }
    /**
     * Initialize the contents of the frame.
     */
    private void initialize() {
        Frame = new JFrame();
        Frame.setTitle("Spreadsheet");
        Frame.setBounds(100, 100, 1000, 800);
        Frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        JMenuBar menuBar = new JMenuBar();
        Frame.setJMenuBar(menuBar);
        JMenu File_Menu = new JMenu("File");
        File_Menu.setFont(f);
        menuBar.add(File_Menu);
        JMenuItem New_Doc = new JMenuItem("New Document");
        New_Doc.setFont(f);
        New_Doc.addActionListener(e -> {
            choicer.setCurrentDirectory(new java.io.File("."));
            choicer.setDialogTitle("New Document");
            choicer.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
            choicer.setAcceptAllFileFilterUsed(false);
            if (choicer.showOpenDialog(new JPanel()) == JFileChooser.APPROVE_OPTION) {
                dir = String.valueOf(choicer.getCurrentDirectory());
            }
        });
        File_Menu.add(New_Doc);
        JMenuItem Save_Doc = new JMenuItem("Save Document");
        Save_Doc.setFont(f);
        File_Menu.add(Save_Doc);
        JMenuItem Open_Doc = new JMenuItem("Open Document");
        Open_Doc.setFont(f);
        File_Menu.add(Open_Doc);
        Frame.getContentPane().setLayout(null);
        m.newTable();
        Table = new JTable(data, columns);
        Table.setBounds(10, 11, 964, 718);
        Table.setFillsViewportHeight(false);
        Frame.getContentPane().add(Table);
        Table.setDragEnabled(false);
    }
    public void newTable() {
        int i = 1;
        columns = new String[10];
        while (i <= 10) {
            columns[i - 1] = String.valueOf(i);
        }
        i = 0;
        int j = 0;
        while (i < 10) {
            while (j < 2) {
                data[i][j] = String.valueOf(i + j);
            }
        }
    }
}
When I run this code, I get the following message:
Exception in thread "main" java.lang.ExceptionInInitializerError Caused by: java.lang.NullPointerException
at Main.initialize(Main.java:76) (this line is:m.newTable();)
at Main.(Main.java:34)
at Main.(Main.java:13)
Why does this happen?
Additionally, is there something wrong in the way in which I'm setting the bounds for the Table?
 
     
    