• Post Reply Bookmark Topic Watch Topic
  • New Topic

InvalidDnDOperationException: Drag and drop in progress

 
Emil Karlsson
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have an applet there I use drag and drop to a grid in a Jpanel. The objects I DnD is for example a JLabel, JButton!

This run without any problem on Win2000 and Internet Explorer! But if I run the same on WinXP I'll get java.awt.dnd.InvalidDnDOperationException: Drag and drop in progress!
I'm using jre1.4. Have tried with later version but had problems with the DnD to function.

Does anyone have a clue to what is the problem?

best regards, Emil Karlsson
[ November 05, 2005: Message edited by: Emil Karlsson ]
 
k Oensen
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey!

I had a problem with these InvalidDnDExceptions too. Not in an applet, but in an application on Win32. I didn't find neither the reason why nor the excact action producing that action. It just sometimes happened. Afterwards, DnD stopped working.
My ugly workaround is to put a try-catch-block around the startDrag-call.
Now, it seems to work fine. Might work for you...
 
k Oensen
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Uhmm... and make sure, that you didn't use setDragEnabled(true);
Probably this causes a double-drag.
 
Emil Karlsson
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, thanks a lot
I'll try the try/catch thing.
The setDragEnabled(true) have read about in some other forums and have checked for.

I also found today that in some cases it can be a good idea to not mix the DnD from AWT and Swing. I've not tried it yet, so I don't know if it is that cause my problem!

Thanks again

Emil Karlsson
 
WarnerJan Veldhuis
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by k Oensen:
Uhmm... and make sure, that you didn't use setDragEnabled(true);
Probably this causes a double-drag.


This is the right solution, thanks
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!