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

📄 alert_midlet.java

📁 本光盘是《J2ME无线移动游戏开发》一书的配套光盘
💻 JAVA
字号:
package ch04;

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

public class Alert_MIDlet
    extends MIDlet {

  //声明一个代表图标的Image对象
  private Image image = null;

  /*
   1.构造器
   */
  public Alert_MIDlet() {
    Alert currentAlert = new Alert("Alert界面组件");
    currentAlert.setString("警告:此为模态提示框");
    try {
      image = Image.createImage("/icons/background/hand.png");
    }
    catch (Exception e) {
      System.out.println(e.getMessage());
    }
    currentAlert.setImage(image);
    currentAlert.setType(AlertType.ALARM);

    currentAlert.setTimeout(Alert.FOREVER);
    //currentAlert.setTimeout(3000);
    Display display = Display.getDisplay(this);
    display.setCurrent(currentAlert);
  }

  //启动应用程序
  public void startApp() {
  }

  //挂起应用程序
  public void pauseApp() {
  }

  //撤销应用程序
  public void destroyApp(boolean unconditional) {
  }
}

⌨️ 快捷键说明

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