My J2ME Programming Contact (3) - Gauge

xiaoxiao2021-03-05  22

/ * * Gaugelet.java * * CREATED ON April 15, 2005, 5:19 pm * /

Import javax.microedition.midlet. *; import javax.microedition.lcdui. *;

/ ** * * @author Administrator * @version * / public class gaugelet extends MIDlet implements CommandListener {private Gauge aGauge; private Form aForm; private Command exitCommand; private Command okCommand; private Display aDisplay; private Alert anAlert; public gaugelet () { AFORM = New form ("gaugetest"); EXITCOMMAND = New Command ("EXIT", Command.exit, 1); Okcommand = New Command ("OK", Command.ok, 1); agauge = new gauge ("gapedisplay" , True, 100, 50); Analert = New Alert ("Value", NULL, NULL, ALERTTYPE.INFO; AFORM.Addcommand; AFORM.Addcommand (OkCommand); AFORM.Append (agauge); AFORM.SETCOMMANDLISTENER (this);} public void startApp () {aDisplay = Display.getDisplay (this); aDisplay.setCurrent (aForm);} public void pauseApp () {} public void destroyApp (boolean unconditional) {} public void commandAction (Command c DISPLAYABLE D) {String s = "the value is"; INT i; if (c == exitcommand) {destroyApp (false); notifyDestroyed ();} else {i = agauge.getValue (); s = integer.tostring (i); Analert.setString (s); adisplay.setcurrent (analert, Afe);}}}

转载请注明原文地址:https://www.9cbs.com/read-34931.html

New Post(0)