Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Is DnD in JTable really impossible? Need good arguments!  RSS feed

Steffen Foldager
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am doing an application that needs Drag&Drop for reordering within a JTable. It's needs to be done with multiple selection, so the use-case is like this:
1) Select a group of rows, spread out over the table.
2) Within the same table, drag the rows to a new position. The rows are moved to new position.
Pretty simple, I should think. I have it all implemented in jdk 1.4.0 and it's working just fine.
But here's the problem: I need to either:
A) Port the above solution to IBM jdk 1.3.1
B) Have really really good reasons (with references) not to do A)
I have tried A for some time and it seems impossible to both have multiple selections and DnD within a JTable in jdk 1.3.1. All my findings on newsgroups shows the same: people having problems but no solutions. Here Georg Kraemer postulates that:
The problem with DnD is that nearly all components which support a SelectionListener have problems when the SelectionListener and the DragGestureRecognizer interfere with each other (am I selecting or dragging?). This applies not only to JTree but also JTable and JTextPane. The only workaround I have found is to disable the SelectionListener for DnD
And I think this is exactly the problem.
So now I'm stuck with B (which I prefere of the two), but I need official references to really really good reasons and I haven't found them.
So, folks, here's my question:
Is it true, is it impossible to do A)??
And if so, have anyone seen any references on the web, in newgroups, in books etc.??
Any help is very much appreciated...
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!