Everyone I am having some problems starting the Drag operation showing an image of the object I want to drag around. I can't seem to get the StartDrag function to work with the parameters I am giving it. If anyone can offer some help I would truly appreciate it.
The function above is where my hard spot is as I can't seem to get it to accept the last two parameters for the Transferable and the DragSourceListener.
I still have not made any headway with this problem. I have looked around the internet and other forums and still can't seem to nail down what am I missing? Any guidance on this would be greatly appreciated and will let me continue to move forward on my project.
I apologies if I was not clear enough and I'll try to straighten that up.
I am trying to use the StartDrag method to start the drag process. The user would see a semi-transparent image of what they are dragging around is the entire goal.
When I try to use:
startDrag(Cursor dragCursor, Image dragImage, Point imageOffset, Transferable transferable, DragSourceListener dsl)
When I hover over what I have provided it in code the Transferable and the DragSourceListener do not have the proper types even though they are implemented in the class. It says it has a type of GangsPanel which is the name of the class that implements both of those methods.
So it has a red X next to that line of code and no matter what I try I can't seem to get it to take the class for those requirements and is where I am stuck. Does that make more sense? I cannot think of any other way of explaining it.
Thank you so much for pointing that out for me! It was just the point that was erroring out and I am surprised I didn't catch that.
It does start the StartDrag method now but does not show the image during the drag. Is there something else I am missing?
Thank you so very much!
Joined: Jun 14, 2013
Probably, it shows an image during the drag. You create a fresh new image with alpha support and then use it for the drag "icon". I didn't check, but that image may be transparent from the start. So it is displayed but you can't see any change on the screen. For tests you should take something more-appropriate than a possible-completely-transparent image. Maybe some external image. Or an image filled with some colour (pure red or green, for example). And try to uses a non-transparent image for some time. It much harder to miss a non-transparent image then a transparent one.
Maxim has the right idea there: when you're testing a new feature which you aren't certain about, start with a simple test and then once you have that working, add the complexities one at a time. Starting out with a complex test provides the opportunity for too many things to go wrong all at once.