Java JTable Column Width Get getColumnWidths(JTable p_Table)

Here you can find the source of getColumnWidths(JTable p_Table)

Description

get Column Widths

License

Open Source License

Declaration

public static int[] getColumnWidths(JTable p_Table) 

Method Source Code

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

import javax.swing.JTable;

import javax.swing.table.TableColumnModel;

public class Main {
    public static int[] getColumnWidths(JTable p_Table) {
        TableColumnModel model = p_Table.getTableHeader().getColumnModel();
        int[] columnWidths = new int[model.getColumnCount()];
        for (int i = 0, c = columnWidths.length; i < c; i++) {
            columnWidths[i] = model.getColumn(i).getWidth();
        }//from  w w w . j a v a2 s  .c om
        return columnWidths;
    }
}

Related

  1. getColumnWidth(JTable table)
  2. getColumnWidths(final JTable table)
  3. getColumnWidths(JTable tbl)
  4. getPreferredColumnWidth(JTable table, int vColIndex, int margin)
  5. getPreferredColumnWidth(JTable table, TableColumn col)
  6. getPreferredHeaderWidth(JTable tbl, int iColumn)