Which row was chosen by the user
How can I tell which row (doesn't really matter to me which text field exactly) was chosen in the JTable. I want to be able to edit a row that was chosen by the user.
I will 开发者_开发百科appreciate any help.
Thanks.
Add a ListSelectionListener to the table's ListSelectionModel. It's quite easy to do. The ListSelectionEvent object passed into the valueChanged method can tell you the selected row(s). Or you could simply query the JTable via its getSelectedRow or getSelectedRows method.
精彩评论