目的:
1.可伸缩的目录树结构,暂时先实现两层。
2.label和存储内容分离。
3.激活和非激活图片分开。
4.通过选择事件可以准确快速找到对应内容
5.存储内容无关性,里面可以放置任何object
实现思路:
1.封装一个expanditem类,用来存储每一条数据。
| /** * 默认图片 */ private string imagepath=""; /* * 激活图片,如果为空说明此图片无效 */ private string selectimgpath=null; /** * 组 */ public static int group=1; /** * 记录 */ public static int item=0; /** * 是否选中,如果选中则默认为展开状态 */ private boolean ifselected=false; /** * 显示label */ private string label; /** * 类型:组,记录 */ private int type; /** * 存储的对象 */ |
| private vector itemlist = new vector(); /*用来存储内容的数据结构*/ private expandlistitem currentselectedobject = null; /*当前所选择的对象,方便获取*/ private int currentselectedindex = -1; /*当前选择的对象在队列中的index,队列有两个,一个是真实数据的存储vector,另外一个是显示在屏幕上的队列。这两个有时候是不一样的。因为有的节点有子节点*/ private vector appearhooklist = new vector(); /*显示在屏幕上的label队列*/ |
[1] [2] [3] 下一页
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器