Select row in Javafx Tableview

╄→尐↘猪︶ㄣ 提交于 2019-12-01 23:49:50

问题


According to my above Table view once I click on any Action icon it will navigate to another window (with selected data). How I keep selected same row when it back again to this Table view. Thanks.


回答1:


So sorry actually I have duplicated the question

Correct answer was there:

Platform.runLater(new Runnable()
{
    @Override
    public void run()
    {
        table.requestFocus();
        table.getSelectionModel().select(0);
        table.getFocusModel().focus(0);
    }
});



回答2:


Just remember the current selection (as a field) in your table view wrapper instance, and the restore it on re-focus.



来源:https://stackoverflow.com/questions/22639386/select-row-in-javafx-tableview

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!