Here's the deal. During layout, the viewport is queried for its
preferred size. The viewport returns one of the following:
- zero width, zero height
- its single child's preferred size if the child's not a Scrollable
- its single child's preferredScrollableViewportSize if the child's a
Scrollable
Since JTable is a Scrollable(i.e., it implements the Scrollable
interface), the viewport returns 3) above. JTable's initial
preferredScrollableViewportSize's height is 400. Thus, you get a height
of 400 even if you set the table's preferred size's height to 17. Call
setPreferredScrollableViewportSize() to change the preferred viewport
size.