Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JTable - reselecting selected row  RSS feed

 
Thomas Paul Bigbee
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I saw this somewhere before, but I just can't remember where.

I have a JTable with a selected row (getSelectedRow()), I then do
an update on the record this row represents and call fireTableDataChanged().
The selected row goes away (bar accross all columns).

My question is this - how do I programatically reselect the column that
I just updated?

any help at all would be appreciated, thanks, in advance, Tom
 
Mahesh x Bogadi
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[/B]table.getSelectionModel().setSelectionInterval(startrow, endrow);[/B]

where :
table is a JTable.
startrow to endrow is the row interval to be selected.

So it we want to selected 1st row then we need to write

table.getSelectionModel().setSelectionInterval(0, 0);
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!