Does anybody know how or of a method that will return the actual row data when selected from a JTable? I've managaed to get the list selection listener working ok. I know this because if i select various rows it will return the row index fine. Is there anyway for it to return the actual row data instead....or perhaps let me say something like....if row 6 is selected, return data for column 3 in a string etc?
I thought a method like getSelectedValue() would work, as this works in a JList, but i guess the JTable is a little more complex! Any help would be greatly appreciated, thank you.
Joined: Jun 07, 2005
Ok reading Stuarts comment here has solved my problem.
You can use the method getValueAt(int row, int col) to return a single cell of data. AFAIK there is no method to get a whole row of data. But if you want to you could grab everything into an array like this:
This is hardcoded to return row zero but you get the idea...