I tried this example. It's exactly what I want. The author has described it here
I've attached a screenshot with "right 3" in the left AND right list. I think this may not be. It is reproducable if you drag and drop sometimes between both lists, you can see that suddenly one entry is in both lists.
Does somebody have a correct example or does somebody see the bug?
Try the ListTransferHandler from the Drop Demo example found in the Swing tutorial.
Joined: Jan 02, 2010
Rob Camick wrote:Try the ListTransferHandler from the Drop Demo example found in the Swing tutorial.
Thanks for your help! I've taken a look at the ListTransferHandler and decided to try my luck with ReportingListTransferHandler again. I've read the Swing tutorial until "Export Methods" and supposed the error is in the exportDone method. I can reproduce the error with this little modification:
The ReportingListTransferHandler is unchanged. Start this now and try to drag "right 6" to the left list. The result is "right 6" in both lists and "right 7" deleted. I want that right 7 is not deleted. It should be where right 6 was.
I suggested that the condition if (addCount > 0) is not correct, because the author wrote:
// If we are moving items around in the same list, we
// need to adjust the indices accordingly since those
// after the insertion point have moved.
So my question is, if you agree with my suggestion: How can I identify if we are moving items around in the same list? Here is the relevant method with some comments:
I've already tried a debugger session with eclipse, and read about getDropLocation(), but until now I do not see the solution.