0
我需要一種很好的方法來維護多個表單層次數據以供選擇菜單。 因此,例如,如果我有 A和B,每一個可能有1 2 3 所以 一個 A1 A2 A3 乙 B1 B2 B3在J2ME中維護多層次選擇菜單列表的好方法
這能持續多久,讓我可以有A - > A1 - > A1.1 - > A1.1.1 -.... 我有以下班級,工作正常但我懷疑我們可以做得更好。
我只需要一個妮選擇樹比如Widget進行選擇,但選擇的每一層樓,在另一種形式(J2ME)
import java.util.Vector;
public class Tag {
private String tag;
private Vector childTags;
private Tag parent;
Tag(String tag, Vector childtag)
{
this.tag = tag;
this.childTags= childTags;
}
public void setChildTags(Vector childTags) {
this.childTags = childTags;
}
public Vector getChildTags() {
return this.childTags;
}
public String getTag() {
return this.tag;
}
public String toString(int depth)
{
String a ="";
if(depth==0)
{
a = a + this.getTag();
}
if(this.getChildTags()!= null)
{
for(int k=0;k <this.getChildTags().capacity(); k++)
{
for (int i=0; i<depth; i++) {
a = a + ("-");
}
a = a+ (((Tag)this.getChildTags().elementAt(k)).toString(depth++));
} }
return a;
}
}
而你的問題是......究竟是什麼? – 2010-03-30 11:41:14