我正在使用 JavaFX TreeTableView ,垂直和水平滚动条都可以工作,水平滚动时我可以看到所有表格的列。
现在我使用 JFoenix 的 JFXTreeTableView 更新同一张表...我可以看到一些列(适合表的大小),其余的没有显示,并且水平滚动条的移动受到限制,当我拖动以调整框架大小时,桌子大小保持不变......知道如何解决这个问题吗?
PS:不使用场景生成器来制作表格,只是对其进行硬编码......并且表格位于 JavaFX ScrollPane 上。`
all columns made as this column,to make short code here
@FXML
protected JFXTreeTableView<Page> table;
@FXML
protected JFXTreeTableColumn<Page,String> location;
private TreeItem<Page> root;
private ObservableList<Page> observList;
@FXML
private void someMethod(ActionEvent event){
location=new JFXTreeTableColumn<> ("Location");
table=new JFXTreeTableView<> ();
observList=FXCollections.observableArrayList ();
observList.add (new Page (1,"1","1-
A","Math","23/4/2017","8:30","room 5"));
root=new RecursiveTreeItem<Page>
(observList,RecursiveTreeObject::getChildren);
location.setCellValueFactory (new
Callback<TreeTableColumn.CellDataFeatures<Page,
String>, ObservableValue<String>> () {
@Override
public ObservableValue<String>
call(TreeTableColumn.CellDataFeatures<Page, String>
param) {
return param.getValue ().getValue ().getCLASSESLOCATION ();
}
});
location.setCellFactory (TextFieldTreeTableCell.forTreeTableColumn
());
location.setOnEditCommit (new
EventHandler<TreeTableColumn.CellEditEvent<Page,
String>> () {
@Override
public void handle(TreeTableColumn.CellEditEvent<Page,
String> event) {
TreeItem<Page> prinClassTableTimeEdited=
table.getTreeItem (event.getTreeTablePosition ().getRow ());
prinClassTableTimeEdited.getValue ().setCLASSESLOCATION
(event.getNewValue ());
}
});
table.setRoot (root);
table.setShowRoot (false);
table.getColumns ().addAll
(grade,class,prinClassesTableDate,time,location);
scrollPanel.setContent (table);
}