Make TableView height match content

Dan Smith daniel.smith at oracle.com
Tue Jan 6 20:26:15 UTC 2015


This may be an intentional limitation, but thought I'd try asking about it.  Caveat: I'm a newbie, could be missing something completely obvious.

I am placing a TableView (plus some other stuff) inside of a VBox, ultimately wrapped by a ScrollPane.  I'd like to use the ScrollPane for all scrolling, and have the table resize fit its content.  So if there are 3 rows, it's 3 rows high; if there are 100 rows, it's 100 rows high.

What's the best way to tell the table to do this?  The default seems to give me a fixed height of about 15 rows, regardless of how much data is included.  I can set a different fixed height, but I don't know how to correctly compute the height I want, and anyway that's just a workaround for having the table figure out its height on its own.

Putting this another way: TableViews automatically wrap their content in a (implicit?) scroll pane.  I'd like to turn that off.  Is there any way to do so?

—Dan


More information about the openjfx-dev mailing list