Hi everybody,
Can anyone help me ?
How can I set a column widths of a JTable, but also allow the user to resize them ?
I tried with a code like
TableColumnModel tableColumnModel = table.getColumnModel();
for (int i=0; i < columnsSizes.length; i++) {
if (columnsSizes[i] > 0) {
tableColumnModel.getColumn(i).setPreferredWidth(preferedSizeArray);
}
}
But it doesn't work :(
When i do [ define the minWidth and maxWidth ]
TableColumnModel tableColumnModel = table.getColumnModel();
for (int i=0; i < columnsSizes.length; i++) {
if (columnsSizes[i] > 0) {
tableColumnModel.getColumn(i).setMinWidth(preferedSizeArray);
tableColumnModel.getColumn(i).setMaxWidth(preferedSizeArray[i]);
}
}
Columns's sizes are exactly what i want but ... the colums are no more resizable.
So,
if anyone can help me and tell me how can i set a predefined size for some colums and also allow the user to resize them ... that would be kind from him.
Thanks