简体   繁体   English

再次选择表格的一行

[英]Select a row of a Table for second time

i currently able to select a row of table using ListSelectionModel object and open a new window. 我目前能够使用ListSelectionModel对象选择表的一行并打开一个新窗口。 but if i close that window and click that row again, it would not open anymore until i select another row of table (i can't select a row for a second time). 但是,如果我关闭该窗口并再次单击该行,它将不会再打开,直到我选择另一行表(我无法第二次选择行)。 do you know how can i solve this issue ? 你知道我该如何解决这个问题?

this is what i have done: 这是我所做的:

ListSelectionModel model = table.getSelectionModel();
model.addListSelectionListener(new ListSelectionListener(){

        public void valueChanged(ListSelectionEvent e)
        {
            if(!model.getValueIsAdjusting())
            {
                int row = model.getMinSelectionIndex();
                //new Window opens :
                SubjectDetail sd = new SubjectDetail(Datalist2.project.listOfData().get(row));
            }
        }
    });

The selection is not working because that particular row is already selected. 该选择无效,因为该特定行已被选择。 Try clearing the selection when a new window is opened. 打开新窗口时,请尝试清除选择。 table.getSelectionModel().clearSelection(). table.getSelectionModel()。clearSelection()。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM