• Post Reply Bookmark Topic Watch Topic
  • New Topic

setting a particular column width and rest should be of default size..

 
Mohammed Ajmal
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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,
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!