tags:

views:

65

answers:

1

Hello there, I'm trying to add a column to a jtable. I've tried this code:

DefaultTableModel model = (DefaultTableModel) table.getModel(); model.addColumn("new column");

but the width of the table doesn't change, but the columns width. In other words, the width of the columns reduces so the new column "fits in" the table, but what I want is precisely the opposite: when I add a column, I want the table to increment its width, so the width of its columns remain unchanged. I've tried, before appending a column, to resize the table, but it doesn't change, even though AUTO_RESIZE_MODE is OFF. Any solution??

A: 

Maybe Jtable must be put in a JScrollPane, I know that the its renderer javax.swing.plaf.basic.BasicTableUI has ties to the JScrollPane.

Houtman