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

📄 selectlist.java

📁 通过Netbeans开发的j2me程序
💻 JAVA
字号:
/*
 * SelectList.java
 *
 * Created on 2007年4月12日, 下午6:09
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

import javax.microedition.lcdui.*;
import java.io.*;

/**
 *
 * @author chenzs
 */
public class SelectList extends List implements CommandListener{
    
        
    /** Creates a new instance of SelectList */
    public SelectList() {
       
       super("TO SELECT ITEM", List.IMPLICIT);   
       Command cmdok = new Command("Upload", Command.OK, 1);
       Command cmdback = new Command("Back", Command.BACK, 1);
       this.addCommand(cmdok);
       this.addCommand(cmdback);
       this.setCommandListener(this);
       //load items
       loadItem();
    }//~end SelectList
    
    
    //upload pic
    public void loadItem(){
        try{
            for(int i = 0; i < 8; i++){
                Image img = Image.createImage("/res/p"+ i + ".png");
                String strItem = "p" + i;
                append(strItem, img);
            }
        }
        catch(IOException e){
            
        }
    }
    
    public void  commandAction(Command cmd, Displayable dis){
        if(dis != this)
            return;
        if(cmd.getCommandType() == Command.BACK){
            HttpMidlet.instance.showMainList();
        }
        else if(cmd.getCommandType() == Command.OK){
            int picIndex = this.getSelectedIndex();
            String path = "/res/p"+picIndex + ".png";
            HttpMidlet.instance.display.setCurrent(
                    new UploadForm("data upload....", path));
        }
    }
    
}

⌨️ 快捷键说明

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