Feb
08
|
By default the column widths of a JTable are automatically set for you. To fix the width of a specified column you need to use the TableColumn for the column (there’s one for each column).
TableColumn column = table.getColumnModel().getColumn(columnIndex); column.setPreferredWidth(width); column.setMaxWidth(width);
Array ( ) One Response to “How to fix a JTable column width”
Leave a Reply
You must be logged in to post a comment.
November 11th, 2011 at 8:46 pm
Thank you! It’s so simple but I didn’t cross my mind. This is the best way to fix a column’s size that only contains a checkbox.