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

📄 showproperties.java

📁 J2ME程序设计实例教程的源码
💻 JAVA
字号:
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class ShowProperties extends MIDlet implements CommandListener {
    private Form form;
    private Command cmdExit = new Command("退出", Command.EXIT, 1);
    
    public ShowProperties() {
        form = new Form("属性列表");
        form.addCommand(cmdExit);
        form.setCommandListener(this);
    }
    
    public void startApp() {
        //读取MIdlet属性,显示在KToolbar的控制台中。
        form.append(new StringItem("MIDlet-Name: ", 
                            getAppProperty("MIDlet-Name")));
        form.append(new StringItem("MIDlet-Version: ", 
                            getAppProperty("MIDlet-Version")));
        form.append(new StringItem("MIDlet-Vendor: ", 
                            getAppProperty("MIDlet-Vendor")));
        form.append(new StringItem("MIDlet-Jar-URL: ", 
                            getAppProperty("MIDlet-Jar-URL")));
        form.append(new StringItem("MIDlet-Jar-Size: ", 
                            getAppProperty("MIDlet-Jar-Size")));
        form.append(new StringItem("MicroEdition-Profile: ", 
                            getAppProperty("MicroEdition-Profile")));
        form.append(new StringItem("MicroEdition-Configuration: ", 
                            getAppProperty("MicroEdition-Configuration")));
        
        //读取自定义属性
        form.append(new StringItem("Cat-Tom: ", getAppProperty("Cat-Tom")));
        
        //读取平台的系统属性
        form.append(new StringItem("microedition.platform: ", 
                            System.getProperty("microedition.platform")));
        
        //编码属性
        form.append(new StringItem("microedition.encoding: ", 
                            System.getProperty("microedition.encoding")));
        form.append(new StringItem("microedition.profiles: ", 
                            System.getProperty("microedition.profiles")));
        form.append(new StringItem("microedition.configuration: ", 
                          System.getProperty("microedition.configuration")));
        
        Display d = Display.getDisplay(this);
        d.setCurrent(form);
    }
  
    public void pauseApp() {
        //
    }
  
    public void destroyApp(boolean force) {
        //
    }
    
    //
    public void commandAction(Command cmd, Displayable d) {
        if(cmd == cmdExit) {
            notifyDestroyed();
        }
    }
}

⌨️ 快捷键说明

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