I'm using the JGraphx library and I have in my application a graph and a tree from which i like to add vertexes to the graph by dragging and dropping a treenode into the mxgraphcomponent.


The nodes in the graph are no mxCell. I added a drag and drop behavior to the tree and called setDropTarget with a specific implementation to retrieve information from my objects of the tree.


The problem now is that I cant move around the elements in the mxgraphComponent as it uses my drag and drop thing.


Is it, and if so, how to make the mxgraphComponent a droptarget without destroying the existing dnd bevahior ?


Thanks in advance

asked 08 Dec '11, 23:29

mremersoncod's gravatar image

accept rate: 12%

I tried to use the DragGestureListener and DragSource as in the example.


but i always get \nException in thread "AWT-EventQueue-1" java.awt.dnd.InvalidDnDOperationException: Drag and drop in progress\n at sun.awt.dnd.SunDragSourceContextPeer.setDragDropInProgress(SunDragSourceContextPeer.java:298)


but I basically just copied the code from EditorPalette.


Is there a flag I forgot to set ?

(08 Dec '11, 23:52) mremersoncod

This normally happens when you call startDrag while Drag and drop is in progress.


answered 07 Jan '12, 22:29

Gaudenz's gravatar image

accept rate: 39%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 08 Dec '11, 23:29

Seen: 2,229 times

Last updated: 07 Jan '12, 22:29