1

私は JGraphX ライブラリを使用しており、 mxFastOrganicLayout を使用して自動レイアウトを実行しようとしています:

import javax.swing.JFrame;
import com.mxgraph.swing.mxGraphComponent;
import com.mxgraph.view.mxGraph;

public class FastOrganic extends JFrame {
    public static void main(String[] args) {
        mxGraph graph = new mxGraph();
        Object parent = graph.getDefaultParent();
        graph.getModel().beginUpdate();
        try {
            Object v1 = graph.insertVertex(parent, null, "Hello", 20, 20, 80,
                    30);
            Object v2 = graph.insertVertex(parent, null, "World!", 240, 150,
                    80, 30);
            graph.insertEdge(parent, null, "Edge", v1, v2);
        } finally {
            graph.getModel().endUpdate();
        }
        mxGraphComponent graphComponent = new mxGraphComponent(graph);

        FastOrganic frame = new FastOrganic();
        frame.add(graphComponent);
        frame.pack();
        frame.setVisible(true);
    }
}

高速な有機レイアウトを適用する方法を知りたいのですが、ドキュメントではそれを と定義していmxFastOrganicLayoutます。問題は、次のようなコンポーネントに変換できないことです。

mxGraphComponent graphComponent = new mxGraphComponent(graph);

asはコンストラクタとしてmxGraphComponent取りませんが、取りますが、どちらが正しい手順のようですか? よろしくお願いします。mxFastOrganicLayoutmxFastOrganicLayoutmxGraph

4

1 に答える 1