File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes JTable Vertical Fill Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTable Vertical Fill" Watch "JTable Vertical Fill" New topic

JTable Vertical Fill

Andrew Cho
Ranch Hand

Joined: Jun 29, 2011
Posts: 50
Hey all,

Does anyone know how to make a JTable fill a container vertically? I don't want to hard code the row size since my GUI needs to be resizable at runtime.

Darryl Burke

Joined: May 03, 2008
Posts: 5115

That depends what you mean by 'fill'. There's setFillsViewportHeight, but if what you want is to adjust the row height you could override getRowHeight() to return getParent().getHeight() / getRowCount().

luck, db
There are no new questions, but there may be new answers.
Andrew Cho
Ranch Hand

Joined: Jun 29, 2011
Posts: 50
Wow that second part was exactly what I was looking for. It works perfectly .

Thank you so much,
I agree. Here's the link:
subject: JTable Vertical Fill
It's not a secret anymore!