This Domain(Admin5.com) is for Sale:

J2ME中实现可伸展目录树TreeList

时间:2007-10-22  来源:不详  作者:林子

       this.currentSelectedObject.setIfselected(true);
       this.itemList.insertElementAt(currentSelectedObject,indexInItemList);
       this.delete(this.currentSelectedIndex);
       this.insert(this.currentSelectedIndex,
       this.currentSelectedObject.getLabel(), icon);
      } else {
       Image icon = Util.getImage(this.currentSelectedObject.getImagePath());
       this.itemList.removeElementAt(indexInItemList);
       this.currentSelectedObject.setIfselected(false);
       this.itemList.insertElementAt(currentSelectedObject,indexInItemList);
       this.delete(this.currentSelectedIndex);
       this.insert(this.currentSelectedIndex,
       this.currentSelectedObject.getLabel(), icon);
      }
      this.setSelectedIndex(this.currentSelectedIndex,true);
     }
    }
   }
  }
}
  附测试代码

import java.util.Vector; 织梦内容管理系统

import javax.microedition.lcdui.Choice;
import javax.microedition.lcdui.Display;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;

import com.skystudio.Canvas.ListCanvas;
import com.skystudio.ExpandList.ExpandList;
import com.skystudio.ExpandList.ExpandListItem;

public class Main extends MIDlet {
  Display d=null;
  protected void startApp() throws MIDletStateChangeException {
   d=Display.getDisplay(this);
   ListTest();
  }
  private void TestUI(){
   ListCanvas l=new ListCanvas();
   d.setCurrent(l);
  }
  private void ListTest(){
   Vector v1=new Vector();
   for(int i=0;i<10;i ){
    v1.addElement(new ExpandListItem("土匪" Integer.toString(i),"/img/default.png","/img/Group-open.png","土匪" Integer.toString(i),ExpandListItem.ITEM,false));
   }
   String v2="警察";
   Vector v3=new Vector();
   for(int i=0;i<10;i ){

看完这篇,您有何感觉呢?

文章评论

共有位Admini5网友发表了评论 查看完整内容