How do I get the indexes of the selected rows in a JTable? Using the table's
ListSelectionModel and addSelectionListener I can get the selected indexes
one at a time but I want to be able to get an array of all the selected
indexes. Is there a method that does this? If not how can I do this?
Thanks
ak - 01 Mar 2004 02:06 GMT
> How do I get the indexes of the selected rows in a JTable? Using the table's
> ListSelectionModel and addSelectionListener I can get the selected indexes
> one at a time but I want to be able to get an array of all the selected
> indexes. Is there a method that does this? If not how can I do this?
http://java.sun.com/docs/books/tutorial/uiswing/events/listselectionlistener
.html
____________
http://reader.imagero.com the best java image reader.
Christian Kaufhold - 01 Mar 2004 12:54 GMT
> How do I get the indexes of the selected rows in a JTable? Using the table's
> ListSelectionModel and addSelectionListener I can get the selected indexes
> one at a time but I want to be able to get an array of all the selected
> indexes. Is there a method that does this? If not how can I do this?
How could such a method be called?
Christian
Tor Iver Wilhelmsen - 01 Mar 2004 18:04 GMT
> How do I get the indexes of the selected rows in a JTable? Using the table's
> ListSelectionModel and addSelectionListener I can get the selected indexes
> one at a time but I want to be able to get an array of all the selected
> indexes. Is there a method that does this? If not how can I do this?
To quote the JTable JavaDoc:
int[] getSelectedRows()
Returns the indices of all selected rows.