I have a JTable of data. I 开发者_如何学Gowant it so that when a row is selected, an event can occur. With a JList, I would simply add a ListSelectionListener. Any way to do this with a JTable?
You can still use your ListSelectionListener with JTable too (take a look at the JavaDocs of ListSelectionListener: JTable also implements it, so you would use it like for your JList).
See an example (but if you already used it with JList, than you know how to use use it with JTable too).
精彩评论