문제

SelectionModel currently handles mouse click and keyboard on select row in cellTable. How do I do it programmatically to move to next/prev row according to current selected row?

도움이 되었습니까?

해결책

  1. In your list of items find the currently selected item
  2. Determine next item that would be selected
  3. Call the SelectionModel.setSelected(T object, boolean selected) method, passing your next object to be selected and true for the selected parameter.

To find the currently selected object (if you don't hold a reference to it anywhere) you can iterate over all the objects in the CellTable and check which one is selected by calling SelectionModel.isSelected(T object) method.

다른 팁

If you don't want to use the selection model directly, you can just use the JTable method:

setRowSelectionInterval
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top