首页 文章

代号树组件,崩溃方法空指针异常

提问于
浏览
1

如何在树组件中使用CollapsePath代号

使用使用collapsePath的Tree组件导致空指针异常由于container = this ....如何解决这个问题..我指定参数为父,子,子的字符串obj你可以指定如何使用collapsePath和expandPath我尝试过使用expandPath和collapsePath,但两者都导致了同样的问题

Tree dt = new Tree(new StringArrayTreeModel()); dt.collapsePath( “颜色”, “红”, “DF”, “GF”);

1 回答

  • 0

    对于这种情况,正确的做法是:

    Form current = new Form("Tree Test", new BorderLayout());
        Tree t = new Tree();
    
        current.add(BorderLayout.CENTER, t);
        current.addShowListener(e -> t.expandPath(null, "Colors"));
        current.show();
    

    但是,当前版本中存在与null根参数相关的错误,该错误应在下周五(2017年5月12日)即将发布的更新中修复 .

相关问题