I need my JTable to automatically re-size its column widths to fit the content. I found the TableColumnAdjuster class very useful. But there\'s a small problem. Say i have 5
You can do this:
JPanel jp = new JPanel();
jp.add(table);
jp.setLayout(new GridLayout(1,1)); /* little trick ;) and believe me that this step is important to the automatic all columns resize! A import is also needed for using GridLayout*/
table.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); // this is obvius part