Java examples for Swing:JTable Column
set JTable Column Width
//package com.java2s; import javax.swing.JTable; import javax.swing.table.TableColumn; public class Main { public static void setColumnWidth(JTable table, int graphicalColumnIndex, int width) { TableColumn tableColumn = getTableColumn(table, graphicalColumnIndex);//from w ww . ja v a 2 s. c om if (tableColumn.getPreferredWidth() != width) { tableColumn.setPreferredWidth(width); } } public static TableColumn getTableColumn(JTable table, int graphicalColumnIndex) { return table.getColumnModel().getColumn(graphicalColumnIndex); } }