Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
AlertTypeDemo.java
Package: J2ME&Game.rar [view]
Upload User: gyyuli
Upload Date: 2013-07-09
Package Size: 3050k
Code Size: 2k
Category:
J2ME
Development Platform:
Java
- import javax.microedition.lcdui.*;
- import javax.microedition.midlet.MIDlet;
- public class AlertTypeDemo
- extends MIDlet implements CommandListener{
- private Command CMD_EXIT=new Command("Exit",Command.EXIT,1);
- private Command CMD_INFO=new Command("INFO",Command.SCREEN,2);
- private Command CMD_WARN=new Command("WARN",Command.SCREEN,3);
- private Command CMD_ERROR=new Command("ERROR",Command.SCREEN,4);
- private Command CMD_ALARM=new Command("ALARM",Command.SCREEN,5);
- private Command CMD_CONF=new Command("CONFIRMATION",Command.SCREEN,6);
- private Display display;
- private Form mainForm;
- private AlertType alertType;
- public AlertTypeDemo() {
- display = Display.getDisplay(this);
- alertType = AlertType.ALARM;
- mainForm = new Form("AlertType演示播放声音");
- mainForm.addCommand(CMD_EXIT);
- mainForm.addCommand(CMD_INFO);
- mainForm.addCommand(CMD_WARN);
- mainForm.addCommand(CMD_ERROR);
- mainForm.addCommand(CMD_ALARM);
- mainForm.addCommand(CMD_CONF);
- mainForm.setCommandListener(this);
- }
- protected void startApp() {
- display.setCurrent(mainForm);
- }
- protected void destroyApp(boolean unconditional) {
- }
- protected void pauseApp() {
- }
- public void commandAction(Command c, Displayable s) {
- int priority = c.getPriority();
- switch(priority){
- case 2:alertType = AlertType.INFO;break;
- case 3:alertType = AlertType.WARNING;break;
- case 4:alertType = AlertType.ERROR;break;
- case 5:alertType = AlertType.ALARM;break;
- case 6: alertType = AlertType.CONFIRMATION;break;
- }
- if(alertType.playSound(display)){
- mainForm.append("声音已经播放n");
- }
- if (c == CMD_EXIT){
- destroyApp(false);
- notifyDestroyed();
- }
- }
- }