getting height of TableView?

Andrew Munn andrew at
Wed Jun 26 17:26:44 UTC 2019

I have a question similar to this one:

I have a table that rows are added & removed from.  I want the SplitPane 
holding the table to resize itself as needed.

<SplitPane fx:id="splitPane" focusTraversable="true" orientation="VERTICAL" prefHeight="-1.0" prefWidth="-1.0" VBox.vgrow="ALWAYS">
         <ScrollPane fx:id="listScrollPane" fitToHeight="true" fitToWidth="true">

When I change my table font size or add/remove rows I currently call this:

public void updateListTableHeight(){
  double h = (tableData.size()+1) * 2.1 * fontSize;
  Platform.runLater(() -> {

This is not an ideal solution.  There must be a better way to get the 
correct table size (no empty space). Best would be to bind the 
ScrollPane height to the TableView height.


More information about the openjfx-dev mailing list