How can I associate my model class with entire row in JTable in order to get link to model class by row number?
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.
Well, you would need to add a getRow(…) method to return the appropriate business object.
I’ve written a generic RowTableModel that does this. It is an Abstract class however, you might be able to use the BeanTableModel which extends the RowTableModel. Or the example shows you how to easily extend RowTableModel by implementing a couple of methods.
Edit:
Add the following two lines to the end of the example: