Java JTable Column createColumnNames(TableModel model)

Here you can find the source of createColumnNames(TableModel model)

Description

create Column Names

License

Open Source License

Declaration

public static Object[][] createColumnNames(TableModel model) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import javax.swing.table.TableModel;

public class Main {
    public static Object[][] createColumnNames(TableModel model) {
        Object rowValues[][] = new Object[2][0];
        rowValues[0] = new Object[model.getColumnCount() != 0 ? model.getColumnCount() - 1 : 0];
        rowValues[1] = new Object[model.getColumnCount() != 0 ? 1 : 0];
        for (int a = 0; a < model.getColumnCount() - 1; a++)
            rowValues[0][a] = model.getColumnName(a);

        if (rowValues[1].length != 0)
            rowValues[1][0] = model.getColumnName(model.getColumnCount() - 1);
        return rowValues;
    }/*from w  ww . j a  va 2s  .c  om*/
}

Related

  1. cloneTableColumnModel(TableColumnModel m)
  2. columnAt(final JTable table, final Point p, final Class columnClazz)
  3. convertColumnIndexToModel(TableColumnModel cm, int viewColumnIndex)
  4. convertColumnIndexToView(TableColumnModel model, int modelCol)
  5. convertSelectedColumnsToModelIndices(JTable table, int[] columns)
  6. createDefaultTableModel(String[] columnNames)
  7. createUneditableTableModel(String... columnNames)
  8. ensureColumnCount(int count, JTable table)
  9. filterTable(JTable table, DefaultTableModel dtm, String text, int[] columns, boolean forceRegEx)