Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.Enumeration;

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

public class Main {
    public static void main(String[] argv) throws Exception {
    }

    public TableColumn[] getColumnsInView(JTable table) {
        TableColumn[] result = new TableColumn[table.getColumnCount()];

        // Use an enumeration
        Enumeration e = table.getColumnModel().getColumns();
        for (int i = 0; e.hasMoreElements(); i++) {
            result[i] = (TableColumn) e.nextElement();
        }

        return result;
    }
}