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();
}