开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜