I currently have JTables nested in JScrollPanes like so:

My problem is that the number of rows in each table is variable when the table is created. What I want to do is make the JScrollpane smaller if the table is too short, but I want to keep it at a set size if the table is too long.
How can I accomplish this?
Where
rowsrepresents the number of rows of data, or the limit.