select 一个 table 列自动在 javafx 中

select a table column automatically in javafx

类似于select生成table row,我们可以select自动生成JavaFXtableviewsingle column(Single cell)吗?

自动,我的意思是,如果我按 down arrow key,只需要 single column 编辑而不是 all columns of single row

谢谢

如果您将 selection 模型的 cellSelectionEnabled 属性 设置为 true,您可以 select 单细胞。

使用箭头键,您可以将 selection selection 移动到由箭头确定的聚焦单元格方向旁边的单元格。

// selection for single cells instead of single 
table.getSelectionModel().setCellSelectionEnabled(true);

// select third cell in first (possibly nested) column
table.getSelectionModel().clearAndSelect(2, table.getVisibleLeafColumn(0));

// focus the same cell
table.getFocusModel().focus(2, table.getVisibleLeafColumn(0));