alert_midlet.java
来自「本光盘是《J2ME无线移动游戏开发》一书的配套光盘」· Java 代码 · 共 45 行
JAVA
45 行
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 + =
减小字号Ctrl + -
显示快捷键?