views:

110

answers:

2

Im creating a table which is dynamically changing its width. And I add columns by time as well. And I have bounded this table to a scrollpane. Here I have set the auto resizing to false in the JTable (else it will fill the whole area from the beginning).

And I'm adding images to cells using cellrenderer as well. Now I need to allow users to resize this table columns.

Any idea?

A: 

Well first of all - just change TableModel. You can leave column resizing on and for example set maximum width of cell by using setMaxWidth Or just pick correct mode that fits your requirements. You can find them here.

Xorty
+1  A: 

I don't understand the question, by default the user is allowed to resize the columns by dragging the header of the column.

However if you want this to happen automatically then you can try using the Table Column Adjuster, which can automatically adjust the columns to fit the size of the data.

camickr