Is there any way to preset column width in pixels wihtout disabling
auto resize in JTable?
Here is my situation:
1. The first column of the table needs to be preset to 30 pixels.
2. I don't want horizontal a scrollbar to appear.
3. I cannot use TableColumn.setMaxWidth, because I want user to be
able to resize column sizes.
TableColumn.setPreferredWidth doesn't work here, the table increases
the width of my column anyway.
Please help!
Regards,
Anton
Initially, it does set the column width to its preferred width. But given
how you have set up the table, it must fill the width of the scroll pane,
so the extra space has to go somewhere, and it distributes the extra space
among the columns. If you set the preferred widths of the columns so that
it adds up to the table width, the columns will remain sized at their
preferred widths.
--
Regards,
John McGrath