0
我被困在遞歸搜索中,我使用gwt,基本上我想搜索gwt樹中的節點,這裏是我的代碼。謝謝advance.I'm在遞歸:-(不好樹中的GWT搜索節點
public TreeItem search2(String sName, TreeItem node){
TreeItem treeItem=null;
String sValue ="";
boolean bFound=false;
System.out.println("Father Node:" + node.getText() + " child nodes:" + node.getChildCount());
for (int i=0;i<node.getChildCount();i++){
treeItem = node.getChild(i);
sValue = treeItem.getText();
System.out.println("searching...."+sValue);
if (sValue.equalsIgnoreCase(sName)){
bFound=true;
System.out.println("!!found!!!!"+sName + " node to return:" + treeItem.getText());
return treeItem;
}
else {
return search2(sName,treeItem);
}
}
return treeItem;
}
你看到了什麼結果? – Ian