Java JTable Column Width Set setColumnWidth(JTable table, int columnIdx, int width)

Here you can find the source of setColumnWidth(JTable table, int columnIdx, int width)

Description

set Column Width

License

LGPL

Declaration

static public void setColumnWidth(JTable table, int columnIdx, int width) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

import javax.swing.JTable;

import javax.swing.table.TableColumn;

public class Main {
    static public void setColumnWidth(JTable table, int columnIdx, int width) {
        TableColumn o = table.getColumnModel().getColumn(columnIdx);

        o.setWidth(width);//from  www  .j a  v a 2  s  . c  o  m
        o.setMaxWidth(width);
        o.setMinWidth(width);
    }
}

Related

  1. setColumnMaxWidths(JTable tbl, Integer... widths)
  2. setColumnMinWidths(final JTable table)
  3. setColumnSize(TableColumnModel cm, int id, int percent, int tablesize, boolean resizeable)
  4. setColumnSizes(JTable table, double[] percentages)
  5. setColumnsSize(TableColumnModel cm, int tablesize)
  6. setColumnWidth(JTable table, int columnIndex, int preferredWidth)
  7. setColumnWidth(JTable table, int columnNumber, int width)
  8. setColumnWidth(JTable table, int... width)
  9. setColumnWidth(JTable table, int[] colWidth)