AlertShowDemo.java
资源名称:J2ME&Game.rar [点击查看]
上传用户:gyyuli
上传日期:2013-07-09
资源大小:3050k
文件大小:2k
源码类别:
J2ME
开发平台:
Java
- import javax.microedition.lcdui.*;
- import javax.microedition.midlet.MIDlet;
- public class AlertShowDemo
- extends MIDlet implements CommandListener{
- private Command CMD_EXIT=new Command("Exit",Command.EXIT,1);
- private Display display;
- // private Form mainForm;
- private Alert alert;
- public AlertShowDemo() {
- display = Display.getDisplay(this);
- // alert = new Alert("Alert 演示","将Alert设置为模态",null,AlertType.INFO);
- // alert = new Alert("Alert 演示","显示过程的内容也能将Alert变成模态。显示过程的内容也能将Alert变成模态。显示过程的内容也能将Alert变成模态。显示过程的内容也能将Alert变成模态。显示过程的内容也能将Alert变成模态。显示过程的内容也能将Alert变成模态。显示过程的内容也能将Alert变成模态。显示过程的内容也能将Alert变成模态。显示过程的内容也能将Alert变成模态。显示过程的内容也能将Alert变成模态。显示过程的内容也能将Alert变成模态。显示过程的内容也能将Alert变成模态。显示过程的内容也能将Alert变成模态。显示过程的内容也能将Alert变成模态。显示过程的内容也能将Alert变成模态。",null,AlertType.INFO);
- // alert.setTimeout(Alert.FOREVER);
- alert = new Alert("Alert 演示","将Alert添加Command",null,AlertType.INFO);
- alert.addCommand(CMD_EXIT);
- alert.setCommandListener(this);
- /* mainForm = new Form("AlertType演示播放声音");
- mainForm.addCommand(CMD_EXIT);
- mainForm.setCommandListener(this);
- */
- }
- protected void startApp() {
- display.setCurrent(alert);
- }
- protected void destroyApp(boolean unconditional) {
- }
- protected void pauseApp() {
- }
- public void commandAction(Command c, Displayable s) {
- if (c == CMD_EXIT){
- destroyApp(false);
- notifyDestroyed();
- }
- }
- }