我想通过JFXTextFiled在JFXTreeTableview中添加行数据(JFXTreeTableview不等于TreeTableview,它们之间的方法不同)。但是我不知道该怎么办。这是我的代码。 (“记录”类包括两个属性:“输入”和“结果”)
public JFXTextField textField;
public JFXTreeTableView<Record> treeTableView;
private JFXTreeTableColumn inputColumn = new JFXTreeTableColumn("Input");
private JFXTreeTableColumn resultColumn = new JFXTreeTableColumn("Result");
public void initialize(){
inputColumn.setCellValueFactory(new PropertyValueFactory<>("input"));
resultColumn.setCellValueFactory(new PropertyValueFactory<>("result"));
treeTableView.getColumns().setAll(inputColumn,resultColumn);
}
public void doSomething(){
String input = textField.getText();
String result = input.reverse();
Record r = new Record(input,result);
//add row from "Record"
}