honkinamiland
asked on
how to resize columns of a JTable to automatically fit content
hi,
i have a jtable, that has three columns. in the first two there is only a number, the last one contains a string. right now every column hast the same size and there is not enough space for the string. how can i make the table to decrease the the with for the first two columns?
i have a jtable, that has three columns. in the first two there is only a number, the last one contains a string. right now every column hast the same size and there is not enough space for the string. how can i make the table to decrease the the with for the first two columns?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
and doLayout in JTable (sorry. That should all have been in one post)
ASKER
ok, i needed also to set the max width to make it work, but that's it.
thanks
thanks
Just in case you need more, there's a good example here:
http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#custom
It's the example after the "Version note" after this heading.
http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#custom
It's the example after the "Version note" after this heading.