posted 22 years ago
That is a problem of the default min size of table columns. Its default minWidth is 15, so if you want to set the width to a value of 12 you first have to set the minWidth to this or a smaller value, for instance setMinWidth(10);
For more details please take a look at swing's source code, class TableColumn, constructor
<code>public TableColumn(int modelIndex, int width, TableCellRenderer cellRenderer, TableCellEditor cellEditor)</code>.
In the constructor the minWidth is set to 15.
In the method <code>setWidth(int width)</code> the width is checked against minWidth and maxWidth:
<code>
...
this.width = Math.min(Math.max(width, minWidth), maxWidth);
...
</code>
There you can see that the desired width only is set if width is greater than minWidth and less than maxWidth...
Good luck!
Tom
[This message has been edited by Thomas Suer (edited October 16, 2001).]