JavaFX之TableView的SelectionMode
table默認是只能選著一行的,如果想選著多行,設置SelectionMode,此時可以對選中的多個進行監聽。?
?
[java]?view plaincopy?
tableView.getSelectionModel()得到的是個抽象類SelectionModel,它有二個子類MultipleSelectionModel, SingleSelectionModel。
getSelectedIndex() ??
getSelectedItem() ??
selectedIndexProperty() ??
selectedItemProperty() ??
selectFirst() ??
selectLast() ??
clearSelection() ??
clearSelection(int index)?
selectIndices(int index, int... indices) ??
selectRange(int start, int end) ??
select(int index) ??
select(T obj) ??
setSelectionMode(SelectionMode.MULTIPLE); ?
MultipleSelectionModel則提供多選功能,并且提供多選的一些方法。?
selectAboveCell() ??
selectBelowCell() ?
selectLeftCell() ??
selectRightCell() ? ?
setCellSelectionEnabled(boolean value) ??
select(int row, TableColumn<S,?> column) ??
選擇變換監聽
[java]?view plaincopy
總結
以上是生活随笔為你收集整理的JavaFX之TableView的SelectionMode的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 说扫雷配置要求特别高是什么梗?
- 下一篇: java之注解