⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 antijpmainform.java

📁 a j2me program for nokia n76,which is a tool with a power function.
💻 JAVA
字号:
/* * AntiJPMainForm.java * 主窗口界面 * Created on 2004年2月7日, 下午7:46 */import javax.microedition.lcdui.*;/** * * @author  wenyy * @version */public class AntiJPMainForm extends Form {    public static Command exitCmd =new Command("退出",Command.EXIT,1);    public static Command okCmd =new Command("查找",Command.SCREEN,1);    public static Command listCmd =new Command("所有列表",Command.SCREEN,2);    public static Command updateCmd =new Command("通过WEB更新",Command.SCREEN,3);    public static Command aboutCmd =new Command("关于...",Command.SCREEN,9);    private TextField tbSearch; //输入搜索的名称    private StringItem []tbResult; //显示搜索结果    public AntiJPMainForm() { // 构造器        super("坚决不买日本货");        tbSearch =new TextField("名称","",20,0);        tbResult = new StringItem[3];        tbResult[0] =new StringItem("结果1"," ");        tbResult[1] =new StringItem("结果2"," ");        tbResult[2] =new StringItem("结果3"," ");        //在界面窗口中添加对象        append("输入厂商名或英文缩写");        append(tbSearch);        append(tbResult[0]);        append(tbResult[1]);        append(tbResult[2]);        append("作者主页:http://wyy.vchelp.net");        //添加命令对象        addCommand(exitCmd);        addCommand(okCmd);        addCommand(listCmd);        addCommand(updateCmd);        addCommand(aboutCmd);    }    //从产品清单中进行搜索    public void search(ProductLoader loader) {        String keyword = tbSearch.getString();        for(int i=0;i<3;i++) //清除原有结果            tbResult[i].setText(" ");        int lastIdx=0;        int found =0;        for(int k=0;k<3;k++) { //查找三个结果            for(;lastIdx<loader.size();lastIdx++) {                String s = (String)loader.arrayLines.elementAt(lastIdx);                if( s.indexOf(keyword) != -1){                    //包含查找的关键字                    lastIdx ++;                    tbResult[k].setText(s);                    found ++;                    break;                }            }        }        if(found ==0)            tbResult[0].setText("暂时没有找到");    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -