Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JTable row drag and drop and multiple selection

796334Apr 26 2007 — edited Jul 9 2008
Given: JTable with multiple selection enabled.

Problem: we made it possible to drag rows to other positions. When dragging a row to another row, all rows in between will be selected, we do not want this.
Question: Is there an easy way to turn this off, without losing the possibility for multiple selection using shift and control?



Details:

Long time ago my colleague implemented the possibility to drag single rows of a JTable to a different location by setting
setDragEnabled(false)
and using the mousePressed and mouseReleased methods of a MouseListener on the table.

This works fine for us.

Multiple selection is turned on in the table, which we use by pressing shift and control.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 5 2008
Added on Apr 26 2007
9 comments
6,348 views