Changing tableview’s height and removing “empty” rows are two different things. Be specific.
For removing rows see this tutorial.
For changing height, first set the fixedCellSizeProperty
of the table view then use it in binding:
table.setFixedCellSize(25);
table.prefHeightProperty().bind(Bindings.size(table.getItems()).multiply(table.getFixedCellSize()).add(30));
Adding 30px is for tableview’s header.