Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.Enumeration;
import java.util.Vector;

import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableColumn;

public class Main {
    public static void main(String[] argv) throws Exception {
        DefaultTableModel model = new MyDefaultTableModel();
        JTable table = new JTable(model);
        table.setModel(model);

        model.addColumn("Col1");
        model.addColumn("Col2");
        model.addColumn("Col3");
        model.addRow(new Object[] { "v1" });

        table.removeColumn(table.getColumnModel().getColumn(0));

    }
}

class MyDefaultTableModel extends DefaultTableModel {
    public Vector getColumnIdentifiers() {
        return columnIdentifiers;
    }
}