• Screan对象


    import javax.microedition.lcdui.Choice;
    import javax.microedition.lcdui.Command;
    import javax.microedition.lcdui.CommandListener;
    import javax.microedition.lcdui.Display;
    import javax.microedition.lcdui.Displayable;
    import javax.microedition.lcdui.List;
    import javax.microedition.midlet.MIDlet;
    import javax.microedition.midlet.MIDletStateChangeException;
    
    
    public class screemObject extends MIDlet implements CommandListener {
    
        Display display = null;
        public screemObject() {
            super();
        }
    
        protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
            // TODO Auto-generated method stub
    
        }
    
        protected void pauseApp() {
            // TODO Auto-generated method stub
    
        }
    
        protected void startApp() throws MIDletStateChangeException {
            display=Display.getDisplay(this);
            List l=new List("List test",Choice.EXCLUSIVE);
            l.append("语文",null);
            l.append("数学", null);
            l.append("英语", null);
            l.setSelectedIndex(1, true);
            l.addCommand(new Command("确定",Command.OK,1));
            l.setCommandListener((CommandListener) this);
            display.setCurrent(l);
        }
        public void commandAction(Command c,Displayable d)
        {
            String cmd = c.getLabel();
            if(cmd.equals("确定"));
            {
                List l = (List)d;
                int i = l.getSelectedIndex();
                System.out.println("你选择了第 "+i+" 个选项");
                String con = l.getString(i);
                System.out.println("选项的名称为 "+ con);
            }
        }
    
    }
  • 相关阅读:
    没有完成的题目
    哈尔滨工程大学 ACM online contest 1008 how many
    POJ 2976 分数规划
    长沙理工 ACM 数位 DP 1488
    POJ 2663
    USETC 1821 AC 自动机
    长沙理工 ACM 分数规划 1494
    正则表达式基础知识(转)
    上传头像代码
    datalist 分页(转)
  • 原文地址:https://www.cnblogs.com/wangchunming/p/2451432.html
Copyright © 2020-2023  润新知