【发布时间】:2018-02-25 14:02:00
【问题描述】:
我需要在用户设置文件中保存列宽,我会在云加载 TableView 时使用与用户之前为更好的用户体验提供的每列相同的宽度。
在我的研究中,有一个关于宽度属性变化的监听器
tcName.widthProperty().addListener(new ChangeListener<Number>() {});
其中“tcName”是列对象。
这会在更改列宽时以原始方式触发几次。
是否有任何事件称为 changed ? 或者
获得如下输出的任何可能性
@FXML
private TableView<ItemEmployee> tvData;
@FXML
private TableColumn<ItemEmployee, String> tcCode;
@FXML
private TableColumn<ItemEmployee, String> tcName;
@FXML
private TableColumn<ItemEmployee, String> tcCompany;
tcCode.setCellValueFactory(new PropertyValueFactory<>("Code"));
tcName.setCellValueFactory(new PropertyValueFactory<>("FullName"));
tcCompany.setCellValueFactory(new PropertyValueFactory<>("CompanyName"));
tvData.columnWidthChanged(){
system.out.println("width changed column name: tcCode/Code " );
system.out.println("width of column tcCode/Code : 150" );
saveColumnWidth("tcCode/Code",150);
};
【问题讨论】:
标签: java javafx tableview tablecolumn