jamie_lynn
asked on
How do I move the selected rows to the top in JTable?
Hi,
How do I move the selected table rows to the top of the table in JTable?
i.e.
If I have selected rows 1,4,5, if I click "move selected" button, the rows move to the top and stay selected.
Thanks
Jamie
How do I move the selected table rows to the top of the table in JTable?
i.e.
If I have selected rows 1,4,5, if I click "move selected" button, the rows move to the top and stay selected.
Thanks
Jamie
table. setRowSelectionInterval(0, 0);
Depends on your TableModel. How is it done? How are the data added to the JTable?
ASKER
objects,
doesn't setRowSelectionInterval selects the rows?
I want to move my selected rows to the top of the tables
geof,
I use a TableModel to add the data.. was this what u were asking?
Thanks
Jamie
doesn't setRowSelectionInterval selects the rows?
I want to move my selected rows to the top of the tables
geof,
I use a TableModel to add the data.. was this what u were asking?
Thanks
Jamie
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Yes and No. Still need to know how the data are added to the TableModel. Is it an ArrayList or an Array or something else?
ASKER
objects,
Does moveRow() keep the selection when the row is moved?
geof,
It's something else.. but if you show me with ArrayList, I can make it work with mine.
Does moveRow() keep the selection when the row is moved?
geof,
It's something else.. but if you show me with ArrayList, I can make it work with mine.
good question, not sure. I would guess the selection stays (but does not move with the rows). May be you need to adjust the selection as part of the move.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.