62,621
社区成员
发帖
与我相关
我的任务
分享
//自定义类
class tempTest{
String str;
tempTest(String str){
this.str = str;
}
public String toString(){
return str;
}
}
//test
ArrayList<tempTest> nodeList = new ArrayList<tempTest>();
tempTest par = new tempTest("parent");
tempTest chd1 = new tempTest("child1");
tempTest chd2 = new tempTest("child2");
tempTest chd3 = new tempTest("child3");
nodeList.add(par);
nodeList.add(chd1);
nodeList.add(chd2);
nodeList.add(chd3);
p3 = treePanel.addObject(null, par); //treePanel是我自己构建好的树 addObject直接添加节点
treePanel.addObject(p3, chd1);
treePanel.addObject(p3, chd2);
treePanel.addObject(p3, chd3);
//test