简体   繁体   English

具有初始顶点的JGraphx图形编辑器

[英]JGraphx Graph Editor with Initial Vertex

I'm Customizing jgraphx graph editor example program. 我正在自定义jgraphx图形编辑器示例程序。 In the graph editor program we can add the vertex to the graph by drag and drop icon from the palette. 在图形编辑器程序中,我们可以通过从调色板中拖放图标将顶点添加到图形中。 But i need to add a initial vertex to the graph that means, In the initial[New] graph editor frame the graph editor's graph should contain one vertex. 但是我需要向图添加一个初始顶点 ,这意味着,在初始[New]图编辑器框架中,图编辑器的图应包含一个顶点。 How can I add a initial vertex to the graph without drag and drop from a palette?. 如何在不从调色板拖放的情况下向图形添加初始顶点?

If you have the jgraphx project checked out, in the GraphEditor try using the insertVertex method in the constructor as follows: 如果您已将jgraphx项目签出,请在GraphEditor中尝试使用构造函数中的insertVertex方法,如下所示:

public GraphEditor(String appTitle, mxGraphComponent component)
{
    super(appTitle, component);
    final mxGraph graph = graphComponent.getGraph();
    graph.insertVertex(graph.getDefaultParent(), null, "Test", 100, 100, 200, 100);
    ...
}

This should give you a vertex to start from 这应该给你一个顶点

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM