set JTable Single Column Width - Java Swing

Java examples for Swing:JTable Column

Description

set JTable Single Column Width

Demo Code


//package com.java2s;
import javax.swing.JTable;
import javax.swing.table.TableColumn;

public class Main {
    public static void setJTableSingleColumnWidth(JTable table, int column,
            int width) {
        TableColumn tc = table.getColumnModel().getColumn(column);
        tc.setPreferredWidth(width);// w  w  w  .ja v  a 2  s  . co m
    }
}

Related Tutorials