Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

selecting rows upwards using mouse in JTable  RSS feed

 
Vijay Daniel
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Can anyone help me to select the rows upwards in the JTable using mouse.
The multi selection mode allows to select the multiple row downwards using mouse but not the other way.

With Regards
Vijay Daniel
 
Vijay Daniel
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I found the answer for the prob...
here is the code...

function 'getValueIsAdjusting' will make sure not to unselect the row again....

if(selectionModel.getValueIsAdjusting())
{
int minIndex = selectionModel.getMinSelectionIndex();
int maxIndex = selectionModel.getMaxSelectionIndex();

// select the corresponding row in the table at viewport
table.setRowSelectionInterval(minIndex,maxIndex);
}


with regards
Vijay
 
Deepan Devadasan
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vijay...


Great attitude..
 
Vijay Daniel
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Theepan...!

With Regards
Vijay
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!