views:

1199

answers:

2

What's the preferred way of this (based on header & contents width I believe)? TIA.

+3  A: 

The Java Developer Almanac contains some good sample code for packing tables based on column width, this may be a good place to start.

Uri
i'd suggest limiting the rows you check if it is a large table. We do things where the model does not actually contain all the data, some is fetched on demand. If you try to look at 1,000,000 rows to calculate width, you'll page in a lot of data!
John Gardner
I agree. If I have heavy tables, I just use fixed sizes (unfortunately).
Uri
+1  A: 

Header and content widths, which include both characters and fonts. You'll need a wider column for a 14 point sans serif font than an 8 point.

duffymo