Alex Rivera | Logout

Drag and drop with an image

Asked 2010-03-11T19:07:56.577
9

I need to create a drag and drop system in swing where an image of the thing being dragged is attached to the cursor during the drag. In theory this is achieveable with

public Icon TransferHandler.getVisualRepresentation(Transferable t)

but there appears to be a long standing bug (here) that means this method is never called. I know I can do it by implementing my own DnD system with DragSource etc., but does anyone know of an easier workround that will get me what I need?

Edit
Report

2 Answers

3

The method TransferHandler.getVisualRepresentation wasn't supported in java 1.4, I'm not sure if or when it was fixed. To test whether it works in a current version you could adapt this example

answered 2010-03-11T20:52:59.767
1

I have used the "work around" suggested towards the bottom of the bug report you have listed. It worked well enough for me. Granted I was using this with Mac OS X so I have no idea whether Winderz will support it. It would be nice if they would at least fix it to work like they intended and simply document where it will and won't work... oh well. Good Luck.

answered 2010-03-13T15:46:22.903

Your Answer