Reputation: 37
I've got myself stuck again.
This time I have a JTable
inside a JFrame
.
I basically just want there to be no "white-space" below the table generated.
When resizing, the rows don't change height, but the columns change width for some reason. Is it at all possible to not have the white space below?
I'd prefer not to have a scrollbar if it at all possible, and just show the entire table with the white space removed, so even when resized, it doesn't show up.
Quick Update: i used the gridlayout layout and it kind of worked, but my header has a bigger font than the table, resulting in the cells to be shown properly, but the headers being cutoff and displayed as "Hea..."
Upvotes: 0
Views: 266
Reputation: 324098
Is it at all possible to not have the whitespace below?
JTable table = new JTable(model);
table.setPreferredScrollableViewportSize(table.getPreferredSize());
JScrollPane scrollPane = new JScrollPane( table );
frame.add(scrollPane);
frame.pack();
frame.setVisible( true );
Upvotes: 1