I have defined a custom canvas style component, using JPanel, that will support the dragging of objects onto the canvas. What I can’t seem to figure out is how to change the drag and drop (DnD) cursor to a custom one, using a TransferHandler. For example, instead of the default link cursor during DnD, I want substitute my own. Is there a way to do this using a TransferHandler?
I suspect I will have to use the AWT DnD support to do this but I am hoping to avoid that if I can.
By digging into the TransferHandler code I found a work around. The dragOver method is where I change the cursor. I still think I may be missing something simple but this will work for now.
The two static class, as well as the code in the exportAsDrag are minorly modified copies of code from the TransferHandler source.
EDIT – This is how I worked it out. Hope this helps. Suggestions welcome.