Multiple Row selection In JTable

I am working with JTable and JList, I can transfer element from table to list and vise versa on clicking on button, my problem is that when i transferred element to either of them that should be selected. i can also transfer multiple item at time and doing sorting with table if i am adding element of 1st row and last row of table, both the rows should be selected.

Any thoughts!!!!!!!!!!!

ThnX

Prashant_SDN

[433 byte] By [Prashant_SDNa] at [2007-11-26 19:09:26]
# 1
For JList,setSelectionMode()setSelectionIndices()setSelectionInterval()addSelectionInterval()Similar for JTable but with Row added.
JayDSa at 2007-7-9 21:04:16 > top of Java-index,Desktop,Core GUI APIs...
# 2

Thnx for response and selection in list is done sucessfully.

I have one additional query, I am transfering element from list to table and did use sorting so rows did not get added after existing row of table but added as per sorting.

so how do i get the index of newly added row after sorting.

Any thoughts!!!!

Prashant_SDNa at 2007-7-9 21:04:16 > top of Java-index,Desktop,Core GUI APIs...
# 3
Why would you need to know the index of the added row in the table view?You know the index in the model...
Rodney_McKaya at 2007-7-9 21:04:16 > top of Java-index,Desktop,Core GUI APIs...
# 4
will index of row not be changed after sorting?
Prashant_SDNa at 2007-7-9 21:04:16 > top of Java-index,Desktop,Core GUI APIs...
# 5
Not in the model.
Rodney_McKaya at 2007-7-9 21:04:16 > top of Java-index,Desktop,Core GUI APIs...
# 6
i have to make selection on various interval but i found only one method to select interval setRowSelectionIntervalwhich makes selection in regular interval.is there any other method?Looking for your response.
Prashant_SDNa at 2007-7-9 21:04:16 > top of Java-index,Desktop,Core GUI APIs...
# 7
addRowSelectionInterval(...);
itchyscratchya at 2007-7-9 21:04:16 > top of Java-index,Desktop,Core GUI APIs...
# 8
I have done it and selection has been made in table but problem is that selection is not visible.what made wrong?~Prashant
Prashant_SDNa at 2007-7-9 21:04:16 > top of Java-index,Desktop,Core GUI APIs...