0

I try to create a GraphicEditor. I use a JTree and Drag & Drop to create Vertexes on a graphcomponent, but I don't know how to drop a created Vertex into another Vertex. How can I specify a Vertex as a Droptarget?

Thanks very much for you help!

Erik

1 Answers1

0

The mxGraph class has boolean method isValidDropTarget(Object cell, Object[] cells). You can override this method and add a return condition such as

if (((mxCell)cell).isVertex())
{
    return true;
}

For this you would have to extend the mxGraph class and in your program use that instead of the default implementation, or you can modify the sources, depending on how you set JGraph to your application.

Additionally, the Swimlane style vertex should allow dropping on top of it by default.

milez
  • 2,201
  • 12
  • 31