相关疑难解决方法(0)

如何绘制表示连接节点图的树?

我想在Java GUI中显示一个树,但我不知道如何.树表示连接节点的图形,如下所示:

图片

我应该说我有自己的树类:

public class BinaryTree  
{
private BinaryNode root;
public BinaryTree( )
{
    root = null;
}

public BinaryTree( Object rootItem )
{
    root = new BinaryNode( rootItem, null, null );
}

public BinaryTree( Object rootItem,BinaryNode a,BinaryNode b )
{
    root = new BinaryNode( rootItem, a, b );
}

public int leavesCount(){
    return BinaryNode.leavesCount(root);
}

public boolean equal(BinaryTree a,BinaryTree b){
    return BinaryNode.equal(a.root, b.root);

}

public void printPreOrder( )
{
    if( root != null )
        root.printPreOrder( );
}

public void …
Run Code Online (Sandbox Code Playgroud)

java swing swt awt

12
推荐指数
2
解决办法
3万
查看次数

标签 统计

awt ×1

java ×1

swing ×1

swt ×1