Yesterday I deliberately read the skill of Eclipse, and once again realized its power, huh, huh.
import javax.microedition.lcdui.Choice; import javax.microedition.lcdui.Command; import javax.microedition.lcdui.CommandListener; import javax.microedition.lcdui.Display; import javax.microedition.lcdui.Displayable; import javax.microedition. LCDUI.List; import javax.microedition.lcdui.tic; import javax.microedition.midlet.midlet; import javax.microedition.midlet.midletStateChangeException; / * * created on 2005-1-26 * /
/ ** * @author aol * / public class CommandTestMIDlet extends MIDlet implements CommandListener {List l; private Display display; / * (non-Javadoc) * @see javax.microedition.midlet.MIDlet # startApp () * / public CommandTestMIDlet ( ) {Display = display.getdisplay (this);} protected void startapp () throws midletStateChangeexception {// Todo auto-generated method stub // form f = new form ("Command Test"); l = new list ("Test Command ", choice.exclusive); L.Append (" Zhuang ", NULL); L.Append (" Xiaoqiang ", NULL); L.Append (" Zhang Yi ", NULL); Command C1 = New Command (" Determined ", Command.ok, 1); Command C2 = New Command (" Exit ", Command.Stop, 2); L.Addcommand (C1); L.Addcommand (C2); L.SetCommandListener (this); // L. RemoveCommand (C3); // Display Display.SetCurrent (L);}
/ * (non-javadoc) * @see javax.microedition.midlet.midlet # Pauseapp () * / protected void Pauseapp () {// Todo auto-generated method stub}
/ * (Non-Javadoc) * @see javax.microedition.midlet.MIDlet # destroyApp (boolean) * / protected void destroyApp (boolean arg0) throws MIDletStateChangeException {// TODO Auto-generated method stub} public void commandAction (Command c, Displayable S) {string str = c.getlabel (); if (Str.Equals)) {L.Setticker (New Ticker ("Runa Lights, Runs Lights, Hahaha ........ "));} Else if (Str.Equals)) {l.setticker (null);}}
}
My simulator is a P800 that loves to love. If you have one, you have a good ~~~