Hi Bruce
You can do, table.getSelectedRow() which returns the index of the selected
row.
and then perform nCols = table.getColumnCount()
The following snippet should work.

int row = table.getSelectedRow();
int nCols = table.getColumnCount();
for (int i = 0; i < nCols; i++)
    System.out.println(table.getValueAt(row, nCols[i]));

Hope this helps!
Regards.... Ravi.
----- Original Message -----
From: "Bruce Jin" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, December 21, 2002 4:34 AM
Subject: Get cell values of a JTable row.


> I want to get all cell values of a row (that was clicked) when I click a
> button outside the table. How to do this?
> I have an action listener for this button. In the actionPerformed() method
I
> have access to the table object.
> Thanks.
> Bruce
>
>
> _______________________________________________
> Swing mailing list
> [EMAIL PROTECTED]
> http://eos.dk/mailman/listinfo/swing


_______________________________________________
Swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/swing

Reply via email to