Sizing of a JTable using GridBagLayout
Posted on 2006-03-28
I am displaying a JTable on the screen, but I cannot set the Default width or Height of the table.
No matter what I try, the JTable appears with the same height and width.
The Horizontal scrollbar appears and I can scroll across to see all the columns.
I want the table to appear at a fixed width - say 800 pixels wide. And the horizontal scrollbar only to appear if needed.
JTable table = new JTable(data, columnHeaders);
I am not sure if the Layout manager i am using is messing with this - prob not.
Can anyone tell me how to fix this please.