Java JTable Column Width Get getColumnWidths(JTable tbl)

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

Description

get Column Widths

License

Open Source License

Declaration

public static List<Integer> getColumnWidths(JTable tbl) 

Method Source Code


//package com.java2s;
//it under the terms of the GNU Affero General Public License as published by

import java.util.ArrayList;
import java.util.Enumeration;

import java.util.List;

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

public class Main {
    public static List<Integer> getColumnWidths(JTable tbl) {
        final List<Integer> result = new ArrayList<Integer>();
        final Enumeration<TableColumn> enumeration = tbl.getColumnModel().getColumns();
        while (enumeration.hasMoreElements()) {
            final TableColumn column = enumeration.nextElement();
            result.add(column.getWidth());
        }/*w  w w.j a v a2s  .com*/
        return result;
    }
}

Related

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