Nathan Drake
Nathan Drake

Reputation: 311

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. 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));
            }
        }
    });

Upvotes: 0

Views: 69

Answers (1)

Saumya Shekhar
Saumya Shekhar

Reputation: 90

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().

Upvotes: 2

Related Questions