I think a better way to do this to get values from the model
and not table. After you know the index of the row that
you clicked on, just get an object that you have in your model
at that location !

- Peter

--- Ravi <[EMAIL PROTECTED]> wrote:
> 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


__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com
_______________________________________________
Swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/swing

Reply via email to