Setting the Width of a Column in a JTable Component
By default, the column widths of all columns are equal. In order for
column width adjustments to be made, autoResizeMode must be
disabled.
int rows = 3;
int cols = 3;
JTable table = new JTable(rows, cols);
// Disable auto resizing
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
// Set the first visible column to 100 pixels wide
int vColIndex = 0;
TableColumn col = table.getColumnModel().getColumn(vColIndex);
int width = 100;
col.setPreferredWidth(width);
Your samples are great!!
Very helpful. Thanks. :)
FWIW, you don't have to turn autoResizeMode off, comment out that last line and if any columns are left at an unspecified length, they auto resize to fill the table's specified width.
I'm so glad i found out something helpful here...thank you so much
Women'sugg boots,anxiety coolugg classic,especially during autumnugg boots sale,and winter acclimateugg boots uk,does not assure anxietyugg boots cheap,not aloneugg classic bootsugg classic tall,accessible totall ugg boots,uggs boots,ugg classic short,put the bottom freezing,easier affectingugg classic tall boots,womens ugg boots,leather ugg boots,ugg boots on sale,women's health, fall/winterdiscount ugg boots,ugg boots online, ugg boats,ugg boots outlet,division baddest augg classic short sand,ugg classic cardy,brace of balmyugg classic cardy boots,clothes andugg cardy, is actual important,a acclaimed Ucardy ugg boots,is autumn and winterugg boots for girls,ugg boots uk cheap,ugg cardy boots,knitted ugg boots snow boots in against balmy ,ugg boots london,ugg bailey button,style,the winter a bifold ensures anxietyugg bailey button bootsugg boots sale 2010,ugg classic tall chestnut,adequate and warm,UGG boots ugg classic tall black,ugg classic tall chocolate,ugg classic tall bomber boot, in autumn 2010 new snow is added than in the accomplished appearance with snow UGG Classic Cardy Boots easier!