Two DropTarget in the same class does not work (Java) ?
I have two Jlist in the same class each with DnD drop enable.
The problem is whatever file I DnD from my desktop to the JLists eith开发者_C百科er number of or number 2 will populate ( and appear ) in JList1. Jlist2 accepts the drag and drop but it is like the content is going to Jlist1 automatically.
Any idea on how to solve that ?
Maybe by cleaning your code ;-)
Take a look at the DropTargetListener you created to enable DnD operations. i think that either it
- adds elements to list 1 datamodel wherever you drop them
- is the same instance for list 1 and list 2, but configured to drop in list 1
精彩评论