Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[Q]: How to move focus to selected row in JTable

249 views
Skip to first unread message

Peter Theill

unread,
Feb 10, 1999, 3:00:00 AM2/10/99
to
Hi,

When I'm selecting a row using e.g.

table.getSelectionModel().setSelectionInterval(10, 10);

I would like to make this row 'visible' if its out of bounds, i.e.
if I have a table with 5 rows visible at a time, I would like the
JTable to 'scroll' down to the newly selected row. How is that possible?


Regards

--
Peter Theill
Software Engineer
Belle Systems
E-mail: p...@belle.dk
Tel.: +45 5944 2500

Peter Theill

unread,
Feb 12, 1999, 3:00:00 AM2/12/99
to
>When I'm selecting a row using e.g.
>
> table.getSelectionModel().setSelectionInterval(10, 10);
>
>I would like to make this row 'visible' if its out of bounds, i.e.
>if I have a table with 5 rows visible at a time, I would like the
>JTable to 'scroll' down to the newly selected row. How is that possible?

Ah - found out. You're able to do it like this:

table.getSelectionModel().setSelectionInterval(row, row);
table.scrollRectToVisible(table.getCellRect(row, row, false));


Regards,

0 new messages