I have two JLists. I want to be able to drag a selection from one into the other and then do stuff with the indices that have been dragged over. For example, I drag the value at index 1 from myFirstJList to mySecondJList and then, for simplicities sake, print out "1"...

This is what I tried based on some example from the Java tutorials:

Java Code:
myFirstJList.setDragEnabled(true);
myFirstJList.setTransferHandler(new TransferHandler() {
	protected Transferable createTransferable(JComponent c) {
		int[] indices = ((JList) c).getSelectedIndices();
		String text = "";

		for (int i = 0; i < indices.length; i++) {
			text += indices[i];
		}
		return new StringSelection(text);
	}

	public int getSourceActions(JComponent c) {
		return COPY_OR_MOVE;
	}
});
With this I can drag a cell or cells from the JList into a JTextArea or something and it will paste the cell indices. It doesn't work if I try to drag into another JList - it shows the "drag not supported" sign thingy... I didn't include the importData method because it didn't seem to be firing anyway... I know that I include include the code I want in the createTransferable method above, but it fires as soon as you start dragging, and I only want it to happen after the drop obviously.

NOTE 2: I cut down the code to make it as simple a possible, so I could see exactly what was happening.

To sum up:
1) Why will it work with a JTextArea but not a JList?
2) How I can I choose what happens at the drop? As I said, the importData method doesn't seem to fire at all...

And I've tried making a TransferHandler for the receiving object but then it won't let me drop there at all - with a JList or even a JTextArea...