Java JTable Column Width Get getColumnWidth(JTable table)

Here you can find the source of getColumnWidth(JTable table)

Description

get Column Width

License

Open Source License

Declaration

public static int[] getColumnWidth(JTable table) 

Method Source Code


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

import javax.swing.*;

public class Main {
    public static int[] getColumnWidth(JTable table) {
        int[] columnWidth = new int[table.getColumnModel().getColumnCount()];
        for (int i = 0; i < columnWidth.length; i++) {
            columnWidth[i] = table.getColumnModel().getColumn(i).getPreferredWidth();
        }/* ww w  .  ja  v a  2 s  .  co  m*/
        return columnWidth;
    }
}

Related

  1. getColumnWidths(final JTable table)
  2. getColumnWidths(JTable p_Table)
  3. getColumnWidths(JTable tbl)
  4. getPreferredColumnWidth(JTable table, int vColIndex, int margin)