Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Drag and drop with an image

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?

like image 570
DJClayworth Avatar asked Mar 11 '10 19:03

DJClayworth


1 Answers

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

like image 101
stacker Avatar answered Sep 25 '22 15:09

stacker