與選擇table row
類似,我們可以自動選擇tableview
的tableview
的JavaFX
嗎?在javafx中自動選擇一個表格列表
自動,我的意思是,如果我按down arrow key
,只single column
需要進行選擇,而不是一個all columns of single row
感謝
與選擇table row
類似,我們可以自動選擇tableview
的tableview
的JavaFX
嗎?在javafx中自動選擇一個表格列表
自動,我的意思是,如果我按down arrow key
,只single column
需要進行選擇,而不是一個all columns of single row
感謝
,如果你選擇模型的cellSelectionEnabled
屬性設置爲true
,你能選擇單個單元格。
使用箭頭鍵可以將選擇選項移動到由箭頭確定的聚焦細胞方向旁邊的單元格。
// 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));
你需要說明你的意思。你的意思是你想要選擇一列中的單個單元格還是全部單元格?表格由行,列和單元格組成,您需要明確說明您要選擇的內容。對我來說,聽起來你想爲特定的列選擇所有的單元格,但當按下「向下箭頭鍵」時沒有意義。 –
我更新了我的問題 – UVM
請問'table.getSelectionModel()。setCellSelectionEnabled(true);'完成你想要的嗎?它允許您選擇單個單元而不是整行。 –