TableView: adjust number of visible rows

前端 未结 6 548
梦谈多话
梦谈多话 2020-11-29 06:30

I\'m using this table to display data in Table View:

import javafx.application.Application;
import javafx.beans.property.IntegerProperty;
import javafx.beans         


        
6条回答
  •  抹茶落季
    2020-11-29 07:06

    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.

提交回复
热议问题