Link to home
Start Free TrialLog in
Avatar of honkinamiland
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?
ASKER CERTIFIED SOLUTION
Avatar of jimmack
jimmack

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jimmack
jimmack

and doLayout in JTable (sorry.  That should all have been in one post)
Avatar of honkinamiland

ASKER

ok, i needed also to set the max width to make it work, but that's it.
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.