Java JTable Column Size Calculate calculateColumnWidth_1(JTable table, int pos)

Here you can find the source of calculateColumnWidth_1(JTable table, int pos)

Description

calculate Column Widt_

License

Open Source License

Declaration

public static int calculateColumnWidth_1(JTable table, int pos) 

Method Source Code

//package com.java2s;

import javax.swing.JTable;

import javax.swing.table.TableColumn;

public class Main {

    public static int calculateColumnWidth_1(JTable table, int pos) {
        for (int ii = 0; ii < table.getColumnModel().getColumnCount(); ii++) {
            TableColumn col = table.getColumnModel().getColumn(ii);
            if (ii == pos) {
                return col.getHeaderValue().toString().getBytes().length * 10;
            }//from   www .  j av  a2s . co  m
        }
        throw new RuntimeException("error!!");
    }
}

Related

  1. calcColumnWidths(final JTable table)
  2. calcColumnWidths(JTable table)
  3. calcColumnWidths(JTable table)
  4. calculateColumnWidth(JTable table, int columnIndex)
  5. calculateColumnWidth(JTable table, int columnIndex)
  6. fixedColumSize(TableColumn c, int width)
  7. fixSize(TableColumn column, JTable table)
  8. initColumnSizes(JTable table)
  9. initColumnSizes(JTable table, boolean[] show)