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

📄 getinfoform.java

📁 基于J2ME的手机程序。可以查看手机当前的一些信息。如手机是彩屏还是黑白
💻 JAVA
字号:
package GetInfo;

import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;

/**
 * <p>Title: GetInfo</p>
 *
 * <p>Description: Get infomation</p>
 *
 * <p>Copyright: Copyright (c) 2007</p>
 *
 * <p>Company: NCU</p>
 *
 * @author Peng P.
 * @version 1.0
 */
public class GetInfoForm extends Form implements CommandListener {
  private Display display;
  private MIDlet midlet;

  public GetInfoForm(MIDlet midlet) {
    super("手机详细信息");
    this.midlet = midlet;
    display = Display.getDisplay(midlet);

    try {
      jbInit();
    } catch (Exception e) {
      e.printStackTrace();
    }
    getColorInfo();
  }

  private void jbInit() throws Exception {
    setCommandListener(this);
    addCommand(new Command("Exit", Command.EXIT, 1));
  }

  private void getColorInfo() {
    this.deleteAll(); //删除窗口现有的对象
    if (display.isColor()) {
      this.append("彩屏手机:\n");
      this.append("支持的颜色数是:" + display.numColors() + "色\n");
      this.append("支持的透明度级别是:" + display.numAlphaLevels() + "级\n");
    }
    else if (display.isColor()) {
      this.append("黑白屏手机:\n");
      this.append("支持的灰度级数是:" + display.numColors() + "级\n");
      this.append("支持的透明度级别是:" + display.numAlphaLevels() + "级\n");
    }
  }

  public void commandAction(Command command, Displayable displayable) {
    if (command.getCommandType() == Command.EXIT) {
      GetInfoMIDlet.quitApp();
    }
  }
}

⌨️ 快捷键说明

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