質問
いで複数の形態レベルのデータmenueます。すればよいでしょうかい A、B、各も1 2 3 なので A A1 A2 A3 B B1 B2 B3
ここでは、長続きし、そしてA->A1->A1.1->A1.1.1-....私は、以下のクラスで、作品が思いります。
だけを実行することが必要な選択ni選択ツリーのようなウィジェットが、それぞれのレベルの選択がもう一つのかたち(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;
}
}
正しい解決策はありません
他のヒント
利用できる授業を代表するメニューコマンド.考える1 2 3B Cコマンドとの組み合わせの作成がそれをつかのパターンここでは利用できるコマンド http://en.wikipedia.org/wiki/Command_pattern )および複合材料( http://en.wikipedia.org/wiki/Composite_pattern ).で動作となるでしょうか簡単に利用および維持のものではなく、神秘的なエラーがchildTagベクトルを利用する際に
所属していません StackOverflow