www.pudn.com > j2mewireless_examples.zip > DoggyMIDlet.java
/*
* Copyright (c) 2000-2001 Sun Microsystems, Inc. All Rights Reserved.
*/
package examples.animation;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
/**
* A MIDlet that displays the Doggy animation.
*
* @author Mark A. Patel - Motorola, Inc.
* @author Roger Riggs - Sun Microsystems, Inc.
**/
public class DoggyMIDlet extends MIDlet implements CommandListener {
Command cmdExit;
/**
* Constructs a new DoggyMIDlet
**/
public DoggyMIDlet() {
cmdExit = new Command("Exit", Command.EXIT, 1);
}
/**
* Starts the app by creating a new Doggy instance and displaying it
**/
protected void startApp() throws MIDletStateChangeException {
Doggy d;
d = new Doggy();
d.addCommand(cmdExit);
d.setCommandListener(this);
Display.getDisplay(this).setCurrent(d);
}
protected void pauseApp() {
}
protected void destroyApp(boolean unconditional)
throws MIDletStateChangeException {
}
public void commandAction(Command c, Displayable d) {
if (c == cmdExit) {
try {
destroyApp(false);
} catch (Exception e) {}
notifyDestroyed();
}
}
}