posted 20 years ago
Hi,
I need to to fix the width of a particular column with some predefined size and it should be resizable while other columns widths should be resizable.
I tried by using
//It resizes all columns
empTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
// To resize a particluar column
empTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
int vColIndex = 1;
javax.swing.table.TableColumn tableColumn = tableActivePlans.getColumnModel().getColumn(vColIndex);
int width = 20;
tableColumn.setPreferredWidth(width);
But here the other columns are not of default size and scroll bar is getting created and last columns are getting minimum size,which will happen. But I need rest columns to be of same size.
Thanks,