I have a JTable of data. I want 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?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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).