我正在尝试为startEdit()
致电TableCell
。
我有一个Button,它在第一个索引处将空白对象/行插入TableView。然后用户输入名称,地址等... 然后按Enter键创建对象。
我需要调用startEdit()
方法,以便第一行中的每个单元格都进入编辑状态。
我在尝试:
public void edit(int row, TableColumn<S,?> column)
但是第一行中的TableCells
没有进入编辑状态,或者调用了与startEdit()
相同的状态。图形(TextField)没有显示,就像我点击单元格一样。
tableView.edit(0, tableView.getColumns().get(0));
//tableView only has one column right now
TableView.edit()的@Javadocs;
Causes the cell at the given row/column view indexes to switch into its editing state, if it is not already in it, and assuming that the TableView and column are also editable.
我不明白这种方法如何将TablePosition
的单元格切换到其编辑状态?
如果tableView.edit()
无法将单元格置于与startEdit().
相同的状态,我还能这样做吗?
更新在调用edit()后单击单元格只需单击一下即可显示文本字段。我不调用edit()的其他单元格需要两个。
**所有TableColumns
,TableRows
,TableCells
和我的TableView
都设置为可编辑。